Can't Login on Twitch with Selenium browser

153 Views Asked by At

I have a problem with login to twitch with selenium. After the bot has entered the credentials, i get from twitch website "Your browser is not currently supported. Please use a recommended browser or learn more here."

and from terminal i get

[24292:18508:1123/140813.240:ERROR:cert_issuer_source_aia.cc(34)] Error parsing cert retrieved from AIA (as DER): ERROR: Couldn't read tbsCertificate as SEQUENCE ERROR: Failed parsing Certificate

the code i used

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
import time

options = webdriver.ChromeOptions()
driver = webdriver.Chrome(options=options)
driver.get("https://www.twitch.tv/")

time.sleep(5)

try:
    login_button = driver.find_element(By.XPATH, '//*[@id="root"]/div/div[2]/nav/div/div[3]/div[3]/div/div[1]/div[1]/button/div')
    login_button.click()
    print("Clicked on the login button.")
except Exception as e:
    print(f"Error clicking on the login button: {e}")

time.sleep(3)

try:
    username_input = driver.find_element(By.XPATH, '//*[@id="login-username"]')
    username = "username"  
    username_input.send_keys(username)
    print(f"Entered username: {username}")
except Exception as e:
    print(f"Error entering username: {e}")

try:
    password_input = driver.find_element(By.XPATH, '//*[@id="password-input"]')
    
    actions = ActionChains(driver)
    actions.move_to_element(password_input).click().send_keys("password").perform()
    
    print("Entered password.")
except Exception as e:
    print(f"Error entering password: {e}")

time.sleep(3)

try:
    final_login_button = driver.find_element(By.XPATH, '/html/body/div[3]/div/div/div/div/div/div[1]/div/div/div[2]/form/div/div[3]/div/button/div/div')
    final_login_button.click()
    print("Clicked on the final login button.")
except Exception as e:
    print(f"Error clicking on the final login button: {e}")

while True:
    pass
0

There are 0 best solutions below