ultrafunkamsterdam / undetected-chromedriver

Custom Selenium Chromedriver | Zero-Config | Passes ALL bot mitigation systems (like Distil / Imperva/ Datadadome / CloudFlare IUAM)
https://github.com/UltrafunkAmsterdam/undetected-chromedriver
GNU General Public License v3.0
9.15k stars 1.1k forks source link

Cannot pass cloudflare "Verify you are human" click #1841

Open NickiHua opened 2 months ago

NickiHua commented 2 months ago

The page will be updated automatically to load the cloudflare click section.

image

image

The html for this click is image

The code I use is

driver = uc.Chrome()
driver.get(url)
time.sleep(10)
print(driver.page_source)

But the page_source is never showing the click part of cloudflare. The url i am using is "http://www.javlibrary.com/cn/" (NSFW!!) Anyone knows how to get the right page_source and make UC to click the button to pass?

sa-dimeny commented 1 month ago

Checkbox is inside an "iframe", so you need to switch to it first. Unfortunately, it'll probably be useless, but you could do something like this:

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver  = ...

wait = WebDriverWait(driver, 10)
iframe = wait.until(EC.presence_of_element_located((By.TAG_NAME, "iframe")))
driver.switch_to.frame(iframe)
checkbox = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, 'input[type="checkbox"]')))
checkbox.click()