I want to automate the restart of my router using Selenium on Python. Everything is working fine except for the last step, which is locating the restart button and click it!
I have tried to locate it by (id, css_selector, name, value, xpath), but nothing seemed to work.
Here is my code:
driver = webdriver.Firefox()
driver.get('http://192.168.100.1')
english = driver.find_element_by_id("English")
english.click()
usr = "username"
pwd = "password"
usrname_box = driver.find_element_by_id("txt_Username")
usrname_box.send_keys(usr)
pwd_box = driver.find_element_by_id("txt_Password")
pwd_box.send_keys(pwd)
submit_ = driver.find_element_by_id("button")
submit_.click()
sleep(1)
resetit = driver.find_element_by_name("maindiv_reset")
resetit.click()
sleep(1)
# This is the one I want to locate
reboot = driver.find_element_by_xpath("//input[@id='btnReboot']")
reboot.click()
And this is the HTML code for the target button:
<input class="ApplyButtoncss buttonwidth_150px" name="btnReboot" id="btnReboot" type="button" onclick="Reboot()" bindtext="s0603" value="Restart">
When trying anything, I get the error:
NoSuchElementException: Message: Unable to locate element: (WHATEVER I TRY)
A Screenshot of the HTML Page:
Thank you all for your help in advance.