Home > front end >  Can't Login on Twitch with Selenium
Can't Login on Twitch with Selenium

Time:10-03

I have a problem to login on twitch with selenium. After the bot has entered the credentials (I also tried to enter them manually) the error message appears: "Something went wrong. Please try again." And it won't let me in.

Any suggestions?

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

def start_twitch_viewer():

    PATH = r"./Local/twitch-stream-viewer/chromedriver"
    email = '[email protected]'
    usr = 'Username'
    pswd = 'Password'


    chrome_options = webdriver.ChromeOptions()

    try:

        driver = webdriver.Chrome(PATH, options=chrome_options)
        driver.get("https://www.twitch.tv/ChannelName")
        driver.header_overrides = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"}

    except:
        return
    
    time.sleep(10)
    driver.find_element(By.CSS_SELECTOR, "div[class='Layout-sc-nxg1ff-0 csWXEI']").click()
    time.sleep(5)
    username=driver.find_element(By.CSS_SELECTOR, "input[id='login-username']")
    password=driver.find_element(By.CSS_SELECTOR, "input[id='password-input']")
    username.clear()
    password.clear()
    username.send_keys(usr)
    password.send_keys(pswd)
    time.sleep(5)
    driver.find_element(By.CSS_SELECTOR, "div[class='Layout-sc-nxg1ff-0 OZCSg']").click()
    

    time.sleep(1000)




if __name__ == "__main__":
    start_twitch_viewer()

CodePudding user response:

I tried that and saw the Something went wrong. notification displayed.
I'm quite sure that site is blocking automated tools like Selenium to prevent boots there.
Try using undetected Selenium.

CodePudding user response:

I believe certain Twitch users have been having issues logging in these past few days so it may be related. I had the "Something went wrong" error on Brave when trying to login but it worked on Edge. There's this article reporting the issue from a couple of days ago:

https://piunikaweb.com/2022/09/30/twitch-users-unable-to-login-getting-something-went-wrong-error/

  • Related