Created
April 13, 2015 15:14
-
-
Save brianddk/fa30efdb253356e1073f to your computer and use it in GitHub Desktop.
Script to use selenium to get private reports from edline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # selenium http://www.seleniumhq.org/download/ | |
| # chromedriver https://sites.google.com/a/chromium.org/chromedriver/downloads | |
| # docs http://selenium-python.readthedocs.org/en/latest/index.html | |
| import time, sys, os | |
| from getpass import getpass | |
| try: | |
| from selenium import webdriver | |
| from selenium.webdriver.common.keys import Keys | |
| except: | |
| print "###\n", "Required modules missing, to acquire:\n", "\t'pip install selenium wget'" | |
| sys.exit(-1) | |
| screenNameTxt = raw_input("Username: ") | |
| kclqTxt = getpass("Password: ") | |
| usrTxt = raw_input("Userhash: ") | |
| try: | |
| driver = webdriver.Chrome() | |
| except: | |
| fname = os.path.join(sys.exec_prefix, 'Scripts', 'chromedriver.exe') | |
| if os.path.exists(fname): | |
| print "###\nEnsure '%s' is in your path" % fname | |
| else: | |
| print "###\nCouldn't find '%s', To aquire:\n" % fname | |
| print "\t'python wget http://chromedriver.storage.googleapis.com/2.15/chromedriver_win32.zip'" | |
| sys.exit(-1) | |
| driver.get('https://www.edline.net/Index.page'); | |
| time.sleep(1) | |
| screenName = driver.find_element_by_name('screenName') | |
| screenName.send_keys(screenNameTxt) | |
| time.sleep(1) | |
| kclq = driver.find_element_by_name('kclq') | |
| kclq.send_keys(kclqTxt) | |
| kclq.send_keys(Keys.RETURN) | |
| time.sleep(1) | |
| driver.execute_script("submitEvent('viewUserDocList', 'TCNK=headerComponent')"); | |
| time.sleep(1) | |
| driver.get('https://www.edline.net/UserDocList.page?vusr=%s' % usrTxt); | |
| time.sleep(5) | |
| driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment