Search code examples
pythonseleniumbots

I am not able to bypass language question in cookieclicker site with my selenium code


from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains

PATH = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)
driver.get("https://orteil.dashnet.org/cookieclicker/")

actions = ActionChains(driver)
driver.implicitly_wait(10)
language = driver.find_element_by_id("langSelect-EN")
actions.click(language).perform()

I found the id of the language, tried .click().perform() but my code is not working to bypass the site's language barrier. what am I missing can someone help me?


Solution

  • In case anyone encounter this problem in the future use from selenium.webdriver.common.by import By

    and the working code is like that

    from selenium import webdriver
    from selenium.webdriver.common.action_chains import ActionChains
    from selenium.webdriver.common.by import By
    
    
    PATH = "C:\Program Files (x86)\chromedriver.exe"
    driver = webdriver.Chrome(PATH)
    
    driver.get("https://orteil.dashnet.org/cookieclicker/")
    
    actions = ActionChains(driver)
    driver.implicitly_wait(10)
    language = driver.find_element(By.ID, "langSelect-EN").click()