Selenium webdriver: Modifying navigator.webdriver flag to prevent selenium detection

前端 未结 10 995
既然无缘
既然无缘 2020-11-22 00:57

I\'m trying to automate a very basic task in a website using selenium and chrome but somehow the website detects when chrome is driven by selenium and blocks every request.

10条回答
  •  日久生厌
    2020-11-22 01:17

    To exclude the collection of enable-automation switches as mentioned in the 6-Nov-2019 update of the top voted answer doesn't work anymore as of April 2020. Instead I was getting the following error:

    ERROR:broker_win.cc(55)] Error reading broker pipe: The pipe has been ended. (0x6D)
    

    Here's what's working as of 6th April 2020 with Chrome 80.

    Before (in the Chrome console window):

    > navigator.webdriver
    true
    

    Python example:

    options = webdriver.ChromeOptions()
    options.add_argument("--disable-blink-features")
    options.add_argument("--disable-blink-features=AutomationControlled")
    

    After (in the Chrome console window):

    > navigator.webdriver
    undefined
    

提交回复
热议问题