undetected-chromedriver icon indicating copy to clipboard operation
undetected-chromedriver copied to clipboard

Still asking for captcha

Open jesseimming opened this issue 1 year ago • 12 comments

When opening, it still gives me the "checking if site is secure" problem. This is the code I used, did I do anything wrong? nowsecure

jesseimming avatar Oct 20 '23 23:10 jesseimming

import undetected_chromedriver as uc import time

if name == 'main': options = uc.ChromeOptions() options.add_argument('--headless') driver = uc.Chrome(options=options, use_subprocess=True) driver.get('https://nowsecure.nl') time.sleep(5) driver.save_screenshot('nowsecure.png') # Wait for 5 seconds to ensure that the browser has fully loaded driver.quit()

jesseimming avatar Oct 20 '23 23:10 jesseimming

You could try to open a new tab manually, and paste the url. You'll find it works. I have no idea why it works like this.😂

MovingW avatar Oct 21 '23 04:10 MovingW

It's because of new tech called Turnstile.

txtsd avatar Oct 21 '23 05:10 txtsd

https://stackoverflow.com/questions/76582307/i-am-using-undetected-chromedriver

I'm a beginner in Python, but the page loads without any problems in Seleniumbase. I'm thinking of converting my projects to seleniumbase.

eem1r avatar Oct 21 '23 09:10 eem1r

It's because of new tech called Turnstile.

Date: 28/09/2022

It's not new.

dexedrine-01 avatar Oct 22 '23 17:10 dexedrine-01

Curious. I read that on Hacker News several days ago and assumed it was NEWs.

txtsd avatar Oct 23 '23 02:10 txtsd

The issue is with the window undetected chrome driver is focused on. Somehow cloudflare can detect that. The way arround is to load pages without focusing in them, you can do that this way:

 driver.execute_script(f"window.open('{URL}', '_blank');")
 time.sleep(3)
driver.switch_to.window(driver.window_handles[1])

Note that I am waiting for CloudFlare validation before switching to the window. This solves the issue for now

pedro-peixot0 avatar Oct 24 '23 12:10 pedro-peixot0

Actually the issue is not even focusing in the screen during Clouflare validation; If you ever focused on the screen the validation will fail even if you are not there while the validation is being done

  driver.execute_script(f"window.open('_blank', 'Testing');")
  driver.switch_to.window(driver.window_handles[1]
  driver.switch_to.window(driver.window_handles[0]
  driver.execute_script(f"window.open('{URL}', 'Testing');")

Even though I am not focusing on the testing window while the URL is loaded, it will be caught by cloudflare

pedro-peixot0 avatar Oct 24 '23 14:10 pedro-peixot0

The issue is with the window undetected chrome driver is focused on. Somehow cloudflare can detect that. The way arround is to load pages without focusing in them, you can do that this way:

 driver.execute_script(f"window.open('{URL}', '_blank');")
 time.sleep(3)
driver.switch_to.window(driver.window_handles[1])

Note that I am waiting for CloudFlare validation before switching to the window. This solves the issue for now

I was wondering how did the website detected if the window is being focused on or not? I've tried opening a new tab manually and executing switching to new window before opening the page, and the other time after opening the page. They all failed.

MovingW avatar Oct 24 '23 14:10 MovingW

The issue is with the window undetected chrome driver is focused on. Somehow cloudflare can detect that. The way arround is to load pages without focusing in them, you can do that this way:

 driver.execute_script(f"window.open('{URL}', '_blank');")
 time.sleep(3)
driver.switch_to.window(driver.window_handles[1])

Note that I am waiting for CloudFlare validation before switching to the window. This solves the issue for now

It works for me. I cannot bypass detection even if manually enter the web url but this solution works.

wzqwwq avatar Nov 21 '23 04:11 wzqwwq

Maybe I'm missing something here, I would assume:

driver.execute_script(f"window.open('{URL}', '_blank');")

Will open a new tab and focus it anyway?

ghost avatar Nov 26 '23 03:11 ghost

I resorted to xvfb and it comes with the benefit of being able to record everything.

ghost avatar Nov 27 '23 02:11 ghost