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

Time:07-01

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?

CodePudding user response:

Simple

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

should be enough - no need to use Actions

CodePudding user response:

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