Created
August 17, 2013 00:27
-
-
Save rsivapr/6254616 to your computer and use it in GitHub Desktop.
To run the code, $ pip install selenium then, $ python renewBot.py
This file contains 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
from selenium import webdriver | |
import getpass | |
driver = webdriver.Firefox() | |
driver.get('https://myaccount.lib.ncsu.edu/') | |
user = driver.find_element_by_name('user_idp') | |
for option in user.find_elements_by_tag_name('option'): | |
if option.text == 'NC State Unity Users': | |
option.click() | |
user.submit() | |
user = driver.find_element_by_id('j_username') | |
username_input = raw_input("Type in your username: ") | |
user.send_keys(username_input) | |
passw = driver.find_element_by_id('j_password') | |
password_input = getpass.getpass("Type in your password: ") | |
passw.send_keys(password_input) | |
passw.submit() | |
driver.get('https://myaccount.lib.ncsu.edu/account/checkedout') | |
for tags in driver.find_elements_by_tag_name('a'): | |
if tags.get_attribute('title')[:5] == 'renew': | |
print tags.get_attribute('title') | |
tags.click() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment