Skip to content

Instantly share code, notes, and snippets.

@wasimosmanhome
Last active August 26, 2020 13:14
Show Gist options
  • Save wasimosmanhome/4a64f8b660405ce3c5410fe2f6ac93fb to your computer and use it in GitHub Desktop.
Save wasimosmanhome/4a64f8b660405ce3c5410fe2f6ac93fb to your computer and use it in GitHub Desktop.
Router restart selenium script
from selenium import webdriver
import time
USERNAME = 'cusadmin'
PASSWORD = 'password'
driver = webdriver.Chrome()
driver.get('http://192.168.2.1/login.html#admin_devreboot/m/4/s/6')
user_input = driver.find_element_by_id('user_login')
user_input.send_keys(USERNAME)
password_input = driver.find_element_by_id('user_password')
password_input.send_keys(PASSWORD)
login_button = driver.find_element_by_id('Login')
login_button.click()
time.sleep(3)
driver.get('http://192.168.2.1/webpages/index.html#admin_devreboot/m/4/s/6')
time.sleep(1)
driver.get('http://192.168.2.1/webpages/index.html#status_system/m/1/s/0')
time.sleep(1)
driver.get('http://192.168.2.1/webpages/index.html#wireless_basic/m/3/s/0')
time.sleep(1)
driver.get('http://192.168.2.1/webpages/index.html#security_firewall/m/5/s/0')
time.sleep(1)
driver.get('http://192.168.2.1/webpages/index.html#admin_devreboot/m/4/s/6')
# admin_button = driver.find_element_by_xpath('/html/body/div/div[1]/div/div/div/ul[1]/li[4]/a/b')
# admin_button.click()
time.sleep(1)
# driver.get('http://192.168.2.1/index.html#admin_devreboot/m/4/s/6')
# driver.refresh()
time.sleep(1)
reboot_button = driver.find_element_by_id('reboot')
reboot_button.click()
time.sleep(1)
alert_window = driver.switch_to.alert
alert_window.accept()
time.sleep(3)
driver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment