I have the HTML of the hcaptcha checkbox as follows: <div id="checkbox" aria-haspopup="true" aria-checked="false" role="checkbox" tabindex="0" aria-live="assertive" aria-labelledby="a11y-label" style="position: absolute; width: 28px; height: 28px; border-width: 1px; border-style: solid; border-color: rgb(145, 145, 145); border-radius: 4px; background-color: rgb(250, 250, 250); top: 0px; left: 0px;"></div>
I tried with the following command but no success:
check = driver.find_element_by_id("checkbox")
driver.execute_script("arguments[0].click();",check)
it returns with error:
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
Some commands like the following don't work either:
driver.find_element_by_xpath('//*[@id="checkbox"]').click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "/html/body/div/div[1]/div[1]/div"))).click()
This link:https://gleam.io/gIxR1/cyball-x-ancient8-20-common-packs-cyblocs-1000-usdt-social-giveaways
Is there anyone on here that can help me with this problem? Thanks
CodePudding user response:
Try to do it with:
check = driver.find_element_by_xpath("/html/body/div/div[1]/div[1]/div")
check.click()
CodePudding user response:
Probably the captcha load in the iframe. so first you have to switch to iframe then locate the captcha
iframe = driver.find_element_by_xpath("IFRAME_XPATH_HERE")
driver.switch_to.frame(iframe)
now you can locate the check box
driver.find_element_by_xpath('//*[@id="checkbox"]').click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "/html/body/div/div[1]/div[1]/div"))).click()