Skip to content

Instantly share code, notes, and snippets.

@rsivapr
Created August 17, 2013 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsivapr/6254616 to your computer and use it in GitHub Desktop.
Save rsivapr/6254616 to your computer and use it in GitHub Desktop.
To run the code, $ pip install selenium then, $ python renewBot.py
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