无法使用 Selenium 浏览器登录 Twitch

问题描述 投票:0回答:1

我在使用 selenium 登录 twitch 时遇到问题。机器人输入凭据后,我得到 来自抽搐网站 “当前不支持您的浏览器。请使用推荐的浏览器或在此处了解更多信息。”

从终端我得到

[24292:18508:1123/140813.240:ERROR:cert_issuer_source_aia.cc(34)] 解析从 AIA 检索的证书时出错(作为 DER): 错误:无法将 tbsCertificate 读取为 SEQUENCE 错误:解析证书失败

我使用的代码

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
python selenium-webdriver bots chatbot twitch
1个回答
0
投票

你解决了吗?我正在尝试用 Pupperteer 做同样的事情(我无法对帖子发表评论)。

© www.soinside.com 2019 - 2024. All rights reserved.