Skip to content

Instantly share code, notes, and snippets.

@yzdann
Created October 24, 2019 21:38
Show Gist options
  • Save yzdann/93e7eb55c7aeb30c63ddaec6c9e2ca16 to your computer and use it in GitHub Desktop.
Save yzdann/93e7eb55c7aeb30c63ddaec6c9e2ca16 to your computer and use it in GitHub Desktop.
from selenium import webdriver
# for kasra :)
url = 'http://url:port/'
tools_url = 'http://url:port/tools_system.php'
password_css_id = "loginpwd"
login_button_css_id = "noGAC"
reboot_css_selector = "form:nth-child(9) input"
# read this from .env file instead of code
password = "password"
driver = webdriver.Firefox()
# we go to first page
driver.get(url)
# findout password form field object
password_field = driver.find_element_by_id(password_css_id)
# filll it up
password_field.send_keys(password)
# click on login button
driver.find_element_by_id(login_button_css_id).click()
# we go to tools page
driver.get(tools_url)
# and click on reboot button
driver.find_element_by_css_selector(reboot_css_selector).click()
# clean up :)
driver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment