How to bypass Cloudflare bot protection in selenium How to bypass Cloudflare bot protection in selenium selenium selenium

How to bypass Cloudflare bot protection in selenium


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 !


SOLUTION JULY 2021

just add user agent argument in chrome options and set user agent to any value

ops = Options() ua='cat' ops.add_argument('--user-agent=%s' % ua) driver=uc.Chrome(executable_path=r"C:\chromedriver.exe",chrome_options=ops)