Pages

05 May, 2024

Python bypass Cloudflare using headless selenium while opening the new tab

I have a website to be scraped, daily around 10k-20k visits to the page. I did it for more than 1 month, and everything is fine.



* I can access it using the non-selenium browser.

* For now, using the Selenium browser, there is Cloudflare which blocks me from visiting. After 3 to 5 click on Cloudflare block, it still distinguishes me as a bot.

* However, under the same Selenium browser, I open this website using a new tab, and it works. However, I still need to click on Cloudflare once to visit the website.






Tried:



* Pass in user agent

* options.add_experimental_option('useAutomationExtension', False)

* options.add_argument('--disable-blink-features=AutomationControlled')

* Selenium headless: How to bypass Cloudflare detection using Selenium

* selenium_stealth (don't know whether in a correct way)




def getDriver():
options = webdriver.ChromeOptions()
# chrome_options.add_argument("--headless")

broswer = uc.Chrome(options=options, version_main=113)

return broswer



How can I modify it to make it work using headless mode?


Current setting: undetected chrome, version = 113

No comments:

Post a Comment

Thanks