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

Issue

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()

Answered By – Talha ┼×engül

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published