Chrome is being controlled by automated test software

后端 未结 13 1078
天涯浪人
天涯浪人 2020-12-01 10:49

I am running automated tests in Chrome with Serenity BDD (Selenium).

I had to download a new ChromeDriver, because my tests could not run -> The test would open Chro

13条回答
  •  爱一瞬间的悲伤
    2020-12-01 11:34

    While the disable-infobars route will work, it will likely suppress the infobar in all cases (as suggested here), not just the case that the OP is referring to. This is overkill at best, and could lead to unexpected and inexplicable behavior in the future if you are not getting some important message.

    I think it's better to leverage the provided enable-automation switch by disabling it in the excludeSwitches area of your config/setup while doing nothing with regards to disable-inforbars. The enable-automation switch's description:

    Inform users that their browser is being controlled by an automated test.

    For nightwatch.conf.js it would look something like this (and worked for me):

    desiredCapabilities: {
      ...
      chromeOptions: {
        excludeSwitches: ['enable-automation'],
        ...
      }
    }
    

    This should only do what we are after: getting rid of that specific pesky message!

    Edit [2017-11-14]: This is now causing an even more annoying Disable Developer Mode Extensions alert/warning. I've tried every relevant-looking flag/switch I could find that might help, but to no avail. I've filed a bug with Chromium, so we'll see and I'll try to swing back through here if I get a resolution.

提交回复
热议问题