1

I'm using python + selenium / undetected_chromedriver to crawl https://chat.openai.com/chat. But I need to click "verify you're a human". enter image description here

I follow the suggestion here: How to find the the CloudFlare human verification element using Selenium

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

driver = webdriver.Chrome(chromedriver)
driver.get('https://chat.openai.com/chat')
time.sleep(10)
element = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.CSS_SELECTOR, "label.ctp-checkbox-label span.mark")))
#element = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, "//label[@class='ctp-checkbox-label']//span[@class='mark']")))
print(element)
time.sleep(5)
driver.quit()

But it looks like this script cannot find the element, and always has error: selenium.common.exceptions.TimeoutException:

Could anyone provide a solution? What's the next step then, i.e., element.click(), to click on the checkbox?? Thanks!

zurich_ruby
  • 315
  • 1
  • 3
  • 8
  • using selenium to click the button won't bypass the cloudflare page. If you really want to bypass it you have to use a paid captcha solving service or maybe xdotool to emulate human mouse movement patterns – zaki98 Mar 12 '23 at 22:10
  • @zaki98 Thanks! Then what was the purpose of finding that checkbox element in the original post? – zurich_ruby Mar 12 '23 at 22:31
  • Seems like you're still getting partially detected. What undetected-chromedrver version do you use? – kaliiiiiiiii Mar 15 '23 at 16:59
  • @kaliiiiiiiii undetected-chromedriver==3.4.6. I think it is the latest one. The partially detection might be set by the website admin to force every user to click on that. Any idea about how to bypass this? – zurich_ruby Mar 17 '23 at 23:51

1 Answers1

3

Using the following script:

import undetected_chromedriver as uc
driver = uc.Chrome()
driver.get('https://chat.openai.com/chat')

worked for me. No capctha is shown.

If the issue still persists, you might try:

  • using Selenium-Profiles
  • using a proxy, in case you can't access the url from a regular browser (your ip got blocked). For example from asocks

Note: I am the developer of Selenium-Profiles

kaliiiiiiiii
  • 925
  • 1
  • 2
  • 21
  • https://pypi.org/project/undetected-chromedriver/2.1.1/ – QuentinJS Mar 23 '23 at 02:17
  • @QuentinJS Yeah, but you might want to use the [newer version](https://pypi.org/project/undetected-chromedriver/) – kaliiiiiiiii Mar 23 '23 at 05:46
  • 1
    @kaliiiiiiiii Thanks for your kind help! I also want to know if there is any solution to click on "verify you are a human", as another site I want to crawl will occasionally pop up that verification, and it is mandatory even for ALL real users. – zurich_ruby Mar 24 '23 at 17:14