How to get rid of the infobar “Chrome is being controlled by automated test software” through Selenium

前端 未结 1 504
傲寒
傲寒 2020-12-04 02:56

Been searching for a while and tried all the solutions present but none appear to be working. I created a \"slide show\" that will first log in, then alternate between tabs.

相关标签:
1条回答
  • 2020-12-04 03:42

    When you open Chrome Browser in through ChromeDriver this infobar containing the notification is embedded as follows:

    Chrome is being controlled by automated test software
    
    • Browser snapshot without the argument disable-infobars:

    But if you add the argument disable-infobars through an instance of ChromeOptions you can get rid of this infobar as follows:

    • Code Block:

      from selenium import webdriver
      from selenium.webdriver.chrome.options import Options
      
      options = Options()
      options.add_argument('start-maximized')
      options.add_argument('disable-infobars')
      driver = webdriver.Chrome(chrome_options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
      driver.get('https://www.google.com/')
      
    • Browser snapshot applying the argument disable-infobars:

    0 讨论(0)
提交回复
热议问题