Search code examples
pythonseleniumselenium-chromedrivercloudflare

How to bypass Cloudflare bot protection in selenium


I need to grab some information from a site just for education purpose, however i cannot send requests because of the protection. I get The typical Checking-your-browser page shows up first and then i'm being redirected repeatedly. how i can bypass this protection in python selenium?


Solution

  • I had this problem a long time ago and I was able to solve it. Use the code below and enjoy :)

    options = webdriver.ChromeOptions()
    options.add_experimental_option("excludeSwitches", ["enable-automation"])
    options.add_experimental_option('useAutomationExtension', False)
    options.add_argument("--disable-blink-features=AutomationControlled")
    driver = webdriver.Chrome(options=options, executable_path=r"webdriver\chromedriver.exe")
    

    ///////// EDIT ////////////////

    this way now is not working !