Python 检测到通过ChromeDriver启动的Chrome浏览器

Python 检测到通过ChromeDriver启动的Chrome浏览器,python,selenium,google-chrome,selenium-webdriver,selenium-chromedriver,Python,Selenium,Google Chrome,Selenium Webdriver,Selenium Chromedriver,我试图在网站www.mouser.co.uk上使用python中的selenium chromedriver。但是,它从第一次拍摄时就被检测为机器人 有人对此有解释吗?。以下是我使用的代码: options = Options() options.add_argument("--start-maximized") browser = webdriver.Chrome('chromedriver.exe',chrome_options=options) wait = WebDriverWait(

我试图在网站www.mouser.co.uk上使用python中的selenium chromedriver。但是,它从第一次拍摄时就被检测为机器人

有人对此有解释吗?。以下是我使用的代码:

options = Options()
options.add_argument("--start-maximized")
browser = webdriver.Chrome('chromedriver.exe',chrome_options=options)
wait = WebDriverWait(browser, 30)
browser.get('https://www.mouser.co.uk')

我已尝试访问url
https://www.mouser.co.uk/
使用某些chrome.options,但确实被检测到,并被重定向到请原谅我们的中断页面

  • 代码块:

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    
    options = Options()
    options.add_argument("start-maximized")
    options.add_argument("disable-infobars")
    options.add_argument("--disable-extensions")
    driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:\Utility\BrowserDrivers\chromedriver.exe')
    driver.get("https://www.mouser.co.uk")
    myElement = WebDriverWait(driver, 30).until(EC.element_to_be_clickable((By.XPATH, "//a[@id='1_lnkLeftFlag']")))
    driver.execute_script("arguments[0].click();", myElement)
    
现在,在检查原谅我们的打扰页面时,您会发现
标签包含:

  • class属性
    distglobalheader
  • class属性
    dist PageWrap
这清楚地表明,网站受到机器人管理服务提供商的保护,ChromeDriver的导航被检测到,随后被阻止


蒸馏 根据该条:

Distil通过观察网站行为和识别刮刀特有的模式,保护网站免受自动内容刮刀的攻击。当Distil在一个站点上识别出恶意bot时,它会创建一个黑名单上的行为配置文件,并部署到其所有客户。类似于机器人防火墙,Distil检测模式并做出反应

此外

“Selenium的一种模式是自动窃取网络内容”
,Distil首席执行官Rami Essaid上周在一次采访中说<代码>“尽管他们可以创建新的机器人,但我们找到了一种方法来识别他们正在使用的工具Selenium,因此无论他们在该机器人上迭代多少次,我们都会阻止Selenium。我们现在使用Python和许多不同的技术来实现这一点。一旦我们看到一种类型的机器人出现了一种模式,我们就会对他们使用的技术进行逆向工程,并将其识别为恶意的。


参考文献 您可以在以下内容中找到一些详细的讨论:


尝试了此处建议的所有内容,但均无效。只有此模块对我有效:

我用它获得了一个有机器人检测的网站。我在前面的回答中尝试使用所有建议的方法,但没有成功。这个模块的使用非常简单,在git repo中也有描述


旁注:版主已经多次删除了这篇文章的前几版,没有一个好的理由。我希望这篇编辑能够通过。祝你好运。

可能重复的nice根本原因分析。这真的很有帮助。