Headless Chrome Driver not working for Selenium Headless Chrome Driver not working for Selenium selenium selenium

Headless Chrome Driver not working for Selenium


This screenshot...

screenshot

...implies that the Cloudflare have detected your requests to the website as an automated bot and subsequently denying you the access to the application.


Solution

In these cases the a potential solution would be to use the undetected-chromedriver in headless mode to initialize the browsing context.

undetected-chromedriver is an optimized Selenium Chromedriver patch which does not trigger anti-bot services like Distill Network / Imperva / DataDome / Botprotect.io. It automatically downloads the driver binary and patches it.

  • Code Block:

    import undetected_chromedriver as ucfrom selenium import webdriveroptions = webdriver.ChromeOptions() options.headless = Truedriver = uc.Chrome(options=options)driver.get(url)

References

You can find a couple of relevant detailed discussions in: