Skip to content

Instantly share code, notes, and snippets.

@yasinkuyu
Created August 25, 2017 18:10
Show Gist options
  • Save yasinkuyu/021b3584e7650a04a8a5042bef7b150f to your computer and use it in GitHub Desktop.
Save yasinkuyu/021b3584e7650a04a8a5042bef7b150f to your computer and use it in GitHub Desktop.
Selenium Python Zyxel (VMG3312-B10B) Router Reboot
def router_reset():
print "Modem resetleniyor"
driver = webdriver.Chrome('./chromedriver')
driver.get('http://192.168.1.1/login.cgi')
username = driver.find_element_by_id('username')
password = driver.find_element_by_id('userpassword')
login = driver.find_element_by_xpath("//li[@class='login_button']//input[@type='submit']")
username.send_keys("admin")
password.send_keys("1234")
login.send_keys(Keys.ENTER)
time.sleep(1)
element_to_hover_over = driver.find_element_by_id("MT")
hover = ActionChains(driver).move_to_element(element_to_hover_over)
hover.perform()
time.sleep(1)
reboot = driver.find_element_by_xpath("//li[@id='MT-Reboot']//a")
reboot.click()
time.sleep(2)
driver.switch_to_frame('mainFrame')
#restart = driver.find_element_by_xpath("//form[@name='theform']")
#restart.submit()
restart = driver.find_element_by_name("sysSubmit")
restart.click()
print "Modem resetlendi"
time.sleep(2)
driver.switch_to_default_content()
okay = driver.find_element_by_xpath("/html/body/div[3]/div[3]/button[2]")
okay.click()
#driver.execute_script("arguments[0].click()", replace);
driver.close()
print "Resetleniyor..."
# modem tekrar başlama süresi
time.sleep(180)
print "Modem yeniden başlıyor."
print "..."
@V3YNjKbFGLSQ0FzpOu1s
Copy link

@dedeoglumrt
Copy link

dedeoglumrt commented Aug 9, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment