Created
February 22, 2017 17:49
-
-
Save farice/7b496122b775ec0e44d209961e07b1a4 to your computer and use it in GitHub Desktop.
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
import getpass | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.support.ui import WebDriverWait | |
userStr = raw_input("Username: ") | |
passStr = getpass.getpass("Password: ") | |
browser = webdriver.Firefox() | |
browser.get('https://sakai.duke.edu') | |
assert 'Duke' in browser.title | |
login = browser.find_element_by_class_name('btn-primary') # Find the search box | |
login.click() | |
#wait = WebDriverWait(browser, 10) | |
#element = wait.until(EC.element_to_be_clickable((By.ID, 'text'))) | |
browser.implicitly_wait(10) # seconds | |
user = browser.find_element_by_name('j_username') | |
user.send_keys(userStr) | |
passw = browser.find_element_by_name('j_password') | |
passw.send_keys(passStr + Keys.RETURN) | |
#browser.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment