Skip to content

Instantly share code, notes, and snippets.

@karngyan
Last active November 3, 2018 10:35
Show Gist options
  • Save karngyan/3bc450c75008926c7159a0a175adec8f to your computer and use it in GitHub Desktop.
Save karngyan/3bc450c75008926c7159a0a175adec8f to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
'''
CC: Yasho Bhaiya
'''
from selenium import webdriver
import time, sys
webbrowser = webdriver.Firefox()
webbrowser.get("https://172.16.1.1:8090/")
# time.sleep(3)
search_form_password = None
search_form_username = None
while search_form_password == None or search_form_username == None:
search_form_username = webbrowser.find_element_by_name('frmHTTPClientLogin').find_element_by_class_name('maindiv').find_element_by_class_name('datablock').find_element_by_class_name('tablecss').find_element_by_id('usernametxt').find_element_by_name('username')
search_form_password = webbrowser.find_element_by_name('frmHTTPClientLogin').find_element_by_class_name('maindiv').find_element_by_class_name('datablock').find_element_by_class_name('tablecss').find_element_by_name('password')
search_form_username.send_keys(open(r"username.txt",'r').read())
search_form_password.send_keys(open(r"password.txt",'r').read())
search_form_submit = webbrowser.find_element_by_name('frmHTTPClientLogin').find_element_by_class_name('maindiv').find_element_by_class_name('datablock').find_element_by_class_name('tablecss').find_element_by_name('btnSubmit')
search_form_submit.click()#logs you in
search_form_submit.click()#Logout
webbrowser.close()
sys.exit(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment