Created
January 4, 2022 12:03
-
-
Save james-ni/59550d985402c4d3518fc2c9f0881931 to your computer and use it in GitHub Desktop.
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 | |
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