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

Question:

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?

Asked By: Talha Sengul

||

Answers:

Simple

driver.find_element_by_id("langSelect-EN").click()

should be enough – no need to use Actions

Answered By: JaSON

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 Sengul
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.