Skip to content

Instantly share code, notes, and snippets.

@to-osaki
Created August 20, 2020 09:32
Show Gist options
  • Save to-osaki/d2f132f3ba9186808acbcec08eea2204 to your computer and use it in GitHub Desktop.
Save to-osaki/d2f132f3ba9186808acbcec08eea2204 to your computer and use it in GitHub Desktop.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
driver = webdriver.Chrome("./chromedriver_win32/chromedriver.exe")
driver.get("https://.../")
waiter = WebDriverWait(driver, 10)
element = waiter.until(
expected_conditions.presence_of_element_located((By.NAME, "Username or email address"))
)
element.send_keys(user_name)
element = waiter.until(
expected_conditions.presence_of_element_located((By.NAME, "Password"))
)
element.send_keys(password)
element = waiter.until(
expected_conditions.element_to_be_clickable((By.ID, "next"))
)
element.send_keys(Keys.RETURN)
waiter.until(
expected_conditions.title_is("....")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment