Unable to select element
There is no such element locator with a.rc-audiochallenge-tdownload-link
, There is id recaptcha-audio-button
present on audio button... Try Id selector..e.g.
WebDriverWait(driver, 30).until(EC.presence_of_element_located(By.ID, "recaptcha-audio-button"))driver.find_element(By.CSS_SELECTOR, "recaptcha-audio-button").click()
I don't know how did you write down such locator: a.rc-audiochallenge-tdownload-link
, There is no such element in the whole page. Is the web page changed later?
To click the #recaptcha-audio-button
, you can use (tested):
from selenium import webdriverfrom selenium.webdriver.common.by import Bydriver = webdriver.Firefox()driver.get(url="https://www.google.com/recaptcha/api2/demo")driver.switch_to.frame(0)driver.find_element(By.CSS_SELECTOR, "div.recaptcha-checkbox-checkmark").click()driver.switch_to.default_content()driver.switch_to.frame(driver.find_element(By.XPATH, "//iframe[@title='recaptcha challenge']"))driver.find_element(By.ID, "recaptcha-audio-button").click()