希望专家能帮助我解开 Selenium/Cloudflare 之谜。我可以让一个网站在普通(非无头)Selenium 中加载,但无论我尝试什么,我都无法让它在无头中加载。
我已遵循 StackOverflow 帖子中的建议,例如Is there a version of Selenium WebDriver that is not detectorable? 。window我还查看了和对象的所有属性window.navigator,并修复了无头和非无头之间的所有差异,但不知何故仍然检测到无头。此时我非常好奇 Cloudflare 如何能够找出其中的差异。谢谢你的时间!
我尝试过的事情列表:
cdc_为 chromedriver 中的另一个字符串options.add_experimental_option("excludeSwitches", ["enable-automation"])options.add_experimental_option('useAutomationExtension', False)options.add_argument('--disable-blink-features=AutomationControlled')(这是让网站以非无头方式加载所必需的)navigator.webdriver = undefinednavigator.plugins、navigator.languages、 和navigator.mimeTypeswindow.ScreenY, window.screenTop, window.outerWidth,设置window.outerHeight为非零window.chrome和window.navigator.chromeModernizr重复实验
为了让网站在正常(非无头)Selenium 中加载,您必须点击_blank另一个网站的链接(以便目标网站在另一个选项卡中打开)。要复制该实验,首先创建一个包含内容的 html 文件<a href="https://poocoin.app" target="_blank">link</a>,然后在以下代码中粘贴该 html 文件的路径。
下面的版本(非无头)运行良好并加载网站,但如果您设置 …