#So, I am trying to do an automated login script in Python.

1 messages · Page 1 of 1 (latest)

inner cradle
#

This is the code. The problem is the code can't acces the 2nd log in button after it puts the email and password.
I think the problem is about the 2nd log in button cause it has shadow roots ?

import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

path = "C:\Program Files (x86)\chromedriver.exe"
service = Service(executable_path=path)
driver = webdriver.Chrome(service=service)

driver.maximize_window()
driver.get("https://reddit.com")

login_button = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.XPATH, '//span[text()="Log In"]'))
)
login_button.click()

login_username = WebDriverWait(driver, 10).until(
EC.visibility_of_element_located((By.ID, 'login-username'))
)
login_username.send_keys("[email protected]")

login_password = WebDriverWait(driver, 10).until(
EC.visibility_of_element_located((By.ID, 'login-password'))
)
login_password.send_keys("xxx")

login_button2 = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.XPATH, '//span[text()="Log In"]'))
)
login_button2.click()

time.sleep(3)
driver.quit()

inner cradle
#

ok so i finally

#

made this

#

its about shadow roots