Can a website detect when you are using selenium with chromedriver?

后端 未结 19 2727
情歌与酒
情歌与酒 2020-11-21 05:41

I\'ve been testing out Selenium with Chromedriver and I noticed that some pages can detect that you\'re using Selenium even though there\'s no automation at all. Even when I

19条回答
  •  旧巷少年郎
    2020-11-21 06:07

    Try to use selenium with a specific user profile of chrome, That way you can use it as specific user and define any thing you want, When doing so it will run as a 'real' user, look at chrome process with some process explorer and you'll see the difference with the tags.

    For example:

    username = os.getenv("USERNAME")
    userProfile = "C:\\Users\\" + username + "\\AppData\\Local\\Google\\Chrome\\User Data\\Default"
    options = webdriver.ChromeOptions()
    options.add_argument("user-data-dir={}".format(userProfile))
    # add here any tag you want.
    options.add_experimental_option("excludeSwitches", ["ignore-certificate-errors", "safebrowsing-disable-download-protection", "safebrowsing-disable-auto-update", "disable-client-side-phishing-detection"])
    chromedriver = "C:\Python27\chromedriver\chromedriver.exe"
    os.environ["webdriver.chrome.driver"] = chromedriver
    browser = webdriver.Chrome(executable_path=chromedriver, chrome_options=options)
    

    chrome tag list here

提交回复
热议问题