Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save james-ni/59550d985402c4d3518fc2c9f0881931 to your computer and use it in GitHub Desktop.
Save james-ni/59550d985402c4d3518fc2c9f0881931 to your computer and use it in GitHub Desktop.
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.implicitly_wait(10) # not a good practice; just for demo purpose
driver.get("http://localhost:3000")
# Landing page
login_button = driver.find_element(By.NAME, "login")
login_button.click()
# Auth0 page
email_box = driver.find_element(By.NAME, "email")
password_box = driver.find_element(By.NAME, "password")
auth0_login_button = driver.find_element(By.NAME, "submit")
email_box.send_keys("<EMAIL>")
password_box.send_keys("<PASSWORD>")
auth0_login_button.click()
# Grab token from local storage
logout_button = driver.find_element(By.NAME, "logout")
token = driver.execute_script("return window.localStorage.getItem('access_token')")
print(token)
driver.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment