0
<input type="text" class="form-control" value="2020-01-23 23:59">

I want to change the value (2020-01-23 23:59) to (2020-01-01 23:59). Here the code I wrote, it is indeed changing the date on like the frontend so when I look at the webpage the date has changed. However, when I look at the Html file it is still the previous date. How can I change the date to whatever date I want and so that change is applied in the backend of the website.

(my code)

time.sleep(2)
startTime = self.driver.find_element_by_xpath('//*[@id="page-wrapper"]/div[2]/div[1]/div/div[3]/div/input')
self.driver.execute_script("arguments[0].value = arguments[1]", startTime, "2020-01-01 00:00")
endTime = self.driver.find_element_by_xpath('//*[@id="page-wrapper"]/div[2]/div[1]/div/div[5]/div/input')
self.driver.execute_script("arguments[0].value = arguments[1]", endTime, "2020-01-01 23:59")
time.sleep(30)
  • Is the traditional `send_keys` not working for you here? You might need to click on a field outside of the `input` to trigger some sort of `onBlur()` event that saves the new date in the backend. It's hard to tell without seeing the website. – CEH Jan 23 '20 at 19:24
  • Can you explain in more detail what you're trying to do? It seems like you want to modify an HTML file, it really isn't clear. – AMC Jan 23 '20 at 22:43

1 Answers1

2

Selenium will only update the html inside the browser. It won't make any changes to the html file on the server. The world would be in trouble if it could.

I you want python to connect to the server, and you have credentials it is possible with something paramiko. Perform commands over ssh with Python

shanecandoit
  • 581
  • 1
  • 3
  • 11