Python 如何绕过selenium中的Cloudflare bot保护

Python 如何绕过selenium中的Cloudflare bot保护,python,selenium,selenium-chromedriver,cloudflare,Python,Selenium,Selenium Chromedriver,Cloudflare,我需要从一个网站抓取一些信息只是为了教育目的,但我不能发送请求,因为保护。我得到了典型的检查你的浏览器页面显示第一,然后我被重定向重复。 如何在python selenium中绕过此保护?我很久以前就遇到过这个问题,我能够解决它。使用下面的代码并享受:) 它在2021年5月不工作。通常,Cloudflare验证大约需要5秒钟。您需要在获取page_源之前添加计时器。只需在driver.page_source之前添加时间。sleep(6)现在不工作,时间是2021年6月15日 options =

我需要从一个网站抓取一些信息只是为了教育目的,但我不能发送请求,因为保护。我得到了典型的检查你的浏览器页面显示第一,然后我被重定向重复。
如何在python selenium中绕过此保护?

我很久以前就遇到过这个问题,我能够解决它。使用下面的代码并享受:)


它在2021年5月不工作。通常,Cloudflare验证大约需要5秒钟。您需要在获取page_源之前添加计时器。只需在driver.page_source之前添加时间。sleep(6)现在不工作,时间是2021年6月15日
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")