Open NCLnclNCL opened 1 year ago
devtool method no longer works for me.
devtool method no longer works for me.
same, however solution one does still work for bypassing cloudflare
devtool method no longer works for me.
same, however solution one does still work for bypassing cloudflare
Solutions 1 not working with me
it stopped working since 12h ago :x
After close analysis. It seems that they detect if you use the first tab entirely. Simply launch the instance on the first tab, wait 5 seconds then open another one and close the first one. Now that second one will be entirely undetected for the rest of the instances life.
After close analysis. It seems that they detect if you use the first tab entirely. Simply launch the instance on the first tab, wait 5 seconds then open another one and close the first one. Now that second one will be entirely undetected for the rest of the instances life.
@epicmatthew23 Do you know how to do it with puppeteer?
After close analysis. It seems that they detect if you use the first tab entirely. Simply launch the instance on the first tab, wait 5 seconds then open another one and close the first one. Now that second one will be entirely undetected for the rest of the instances life.
@epicmatthew23 Do you know how to do it with puppeteer?
Did you succeed?
@epicmatthew23 Code snippet?
This code works for me:
import undetected_chromedriver as uc
import os
from time import sleep
current_dir = os.getcwd()
target_url = 'https://nowsecure.nl'
with open('blank.html', 'w') as f:
f.write(f'<a href="{target_url}" target="_blank">link</a>')
driver = uc.Chrome(headless=True, use_subprocess=False)
driver.get(f'file://{current_dir}/blank.html')
links = driver.find_elements(By.XPATH, "//a[@href]")
sleep(10)
links[0].click()
sleep(5)
driver.switch_to.window(driver.window_handles[1])
driver.save_screenshot('nowsecure.png')
I dont know why, but it doesn't work without sleep.
devtools option or opening a new tab doesn't work for me neither. Is there any other solution to this cloudflare problem?
+) opening a new tab is working well now I increased seconds in time.sleep()
They just pushed new update around 2023-07-19 17:00 GMT+2
I think they're detecting chromedriver somehow... can click on turnstile forever via API or manually when launched via chromedriver...
My old code:
driver.execute_script("window.open('https://someprotectedwebsite', '_blank')")
driver.switch_to.window(driver.window_handles[1])
My new code:
driver.execute_script("window.open('https://someprotectedwebsite', '_blank')")
+ sleep(15)
driver.switch_to.window(driver.window_handles[1])
If you call the switch_to_window() while cloudflare is checking the browser, it will get detected So simple solution is just wait a few seconds for cloudflare to load before switching to the window :)
refresh will lead to block again, any idea?
refresh will lead to block again, any idea?
Yes, if you want to bypass the turnstile within the site it's dead, when selenium touches the tab it's over. Wonder how they are detecting it.
My solution
My old code:
driver.execute_script("window.open('https://someprotectedwebsite', '_blank')") driver.switch_to.window(driver.window_handles[1])
My new code:
driver.execute_script("window.open('https://someprotectedwebsite', '_blank')") + sleep(15) driver.switch_to.window(driver.window_handles[1])
If you call the switch_to_window() while cloudflare is checking the browser, it will get detected So simple solution is just wait a few seconds for cloudflare to load before switching to the window :)
works for me, thx
Try to use sleep() as in my example.
Try to use sleep() as in my example.
but if cloudflare has checkbox you can't pass it
Try to use sleep() as in my example.
but if cloudflare has checkbox you can't pass it
Try this it worked for me.
import undetected_chromedriver as uc
chrome_options = uc.ChromeOptions() chrome_options.add_argument("--disable-popup-blocking")
driver = uc.Chrome(options=chrome_options)
url = 'https://nowsecure.nl/' driver.get(url) driver.execute_script(f"window.open('{url}', '_blank')") input()
If your issue is related to Chrome 115, then according to https://github.com/SeleniumHQ/selenium/milestone/12, the earliest that the fix will be available in selenium
is sometime next week.
Until then, you can use SeleniumBase's UC Mode as an alternative, which has the fix for Chrome 115.
First pip install seleniumbase
, and then run the following script with python
:
from seleniumbase import Driver
import time
driver = Driver(uc=True)
driver.get("https://nowsecure.nl/#relax")
time.sleep(8)
driver.quit()
Once selenium
gets a new release, undetected-chromedriver
can pull that in and make updates as necessary.
Aside from warning... it works just fine
jul. 21, 2023 3:57:08 DOP. org.openqa.selenium.devtools.CdpVersionFinder findNearestMatch
WARNING: Unable to find an exact match for CDP version 115, so returning the closest version found: 113```
pip install seleniumbase
If your issue is related to Chrome 115, then according to https://github.com/SeleniumHQ/selenium/milestone/12, the earliest that the fix will be available in
selenium
is sometime next week.Until then, you can use SeleniumBase's UC Mode as an alternative, which has the fix for Chrome 115.
First
pip install seleniumbase
, and then run the following script withpython
:from seleniumbase import Driver import time driver = Driver(uc=True) driver.get("https://nowsecure.nl/#relax") time.sleep(8) driver.quit()
Once
selenium
gets a new release,undetected-chromedriver
can pull that in and make updates as necessary.
there is a problem when it download the driver for the first time and open the website it bypasses the cf but second time it get stock!
If your issue is related to Chrome 115, then according to https://github.com/SeleniumHQ/selenium/milestone/12, the earliest that the fix will be available in
selenium
is sometime next week.Until then, you can use SeleniumBase's UC Mode as an alternative, which has the fix for Chrome 115.
First
pip install seleniumbase
, and then run the following script withpython
:from seleniumbase import Driver import time driver = Driver(uc=True) driver.get("https://nowsecure.nl/#relax") time.sleep(8) driver.quit()
Once
selenium
gets a new release,undetected-chromedriver
can pull that in and make updates as necessary.
the problem is when you open 2 script at the same time the second one sucks and if you don't close the first one with driver.quit() all other scripts gonna stock and you have to close the uc_driver.exe from task manager before running other script. SO THIS CODE SUCKS
If you're not going to close the driver yourself at the end of your script with driver.quit()
, then use the seleniumbase context manager format instead, which does that for you:
import time
from seleniumbase import DriverContext
with DriverContext(uc=True) as driver:
driver.get("https://nowsecure.nl/#relax")
time.sleep(6)
Only one script like that can be run at the same time. (Single-threaded only!)
Once you start performing any selenium actions on the page, (such as clicking, switching to a tab, or executing javascript), websites can detect selenium (as of today). Maybe pyautogui can help with undetected clicking, etc.
To prevent CF from blocking your automation, you need to hide the CDP session from it. You can check this by disabling CDP in an already running browser. The captcha will immediately let you through, even if you are already on the page with it.
soo you find any way to CDP session?
FYI, seleniumbase's SB mode works a treat at the moment.
Example implementation: https://github.com/KlevGG/TrackerScreenshot/pull/3/commits/12fceea25807347697dc8bfa454435f0da3f6a62
This Python script utilizes undetected_chromedriver
to interact with a webpage and bypass Cloudflare. It demonstrates how to handle a webpage that may have Cloudflare protection by navigating through a series of steps and taking a screenshot. Below is an overview and explanation of the script:
Setup:
blank.html
) containing a link to a target URL.Driver Initialization:
undetected_chromedriver
.Navigation:
import undetected_chromedriver as uc
import os
from time import sleep
from selenium.webdriver.common.by import By
current_dir = os.getcwd()
target_url = 'https://nowsecure.nl'
with open('blank.html', 'w') as f:
f.write(f'<a href="{target_url}" target="_blank">link</a>')
driver = uc.Chrome(headless=True, use_subprocess=False)
driver.get(f'file://{current_dir}/blank.html')
links = driver.find_elements(By.XPATH, "//a[@href]")
sleep(10)
links[0].click()
sleep(5)
driver.switch_to.window(driver.window_handles[1])
driver.save_screenshot('nowsecure.png')
...devtool open gives me some errors