Chrome 由自动化测试软件控制

我正在使用 Serenity BDD (Selenium) 在 Chrome 中运行自动化测试.

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

我必须下载新的 ChromeDriver,因为我的测试无法运行 -> 测试会打开 ChromeDriver,但无法以用户身份浏览".当我用谷歌搜索这个问题时,他们说我必须更新 ChromeDriver.

I had to download a new ChromeDriver, because my tests could not run -> The test would open ChromeDriver but could not "Browse as user". When I googled the issue, they said I had to update ChromeDriver.

所以我将 ChromeDriver 更新到 2.28 版,并将 Chrome 版本更新到 57.0.2987.98 版.

So I updated ChromeDriver to version 2.28 and I also updated the Chrome version to Version 57.0.2987.98.

但是现在 - 每次我运行测试时都会出现这个烦人的文本:

But now - EVERY TIME I run my tests this annoying text comes up:

Chrome 由自动化测试软件控制

Chrome is being controlled by automated test software

它询问我是否要保存密码.(我不能加图片,因为我没有足够的点")

And it asks me if I want to save password. (I can't add pictures because I don't have enough "points")

在以前的版本中,我设法通过以下方式阻止了这两件事:

In the previous version, I had managed to block these 2 things by:

public class CustomChromeDriver implements DriverSource {

    @Override
    public WebDriver newDriver() {
        try {
            DesiredCapabilities capabilities = DesiredCapabilities.chrome();
            Proxy proxy = new Proxy();
            String proxyServer = String.format("AProxyIDontWantToDisplay", System.getenv("proxy.username"), System.getenv("proxy.password"));
            proxy.setHttpProxy(proxyServer);
            capabilities.setCapability("proxy", proxy);
            ChromeOptions options = new ChromeOptions();
            options.addArguments(Arrays.asList("--no-sandbox","--ignore-certificate-errors","--homepage=about:blank","--no-first-run"));
            capabilities.setCapability(ChromeOptions.CAPABILITY, options);
            ChromeDriver driver = new ChromeDriver(capabilities);
            return driver;
        } catch (Exception e) {
            throw new Error(e);
        }
    }

    @Override
    public boolean takesScreenshots() {
        return true;
    }
}

我知道有这个(同一个问题的链接),但是有太多的答案不起作用.

I know there is this one (A link to same issue), but there are too many answers that don't work.

有谁知道如何删除它?

推荐答案

将此添加到您传递给驱动程序的选项中:

Add this to the options you pass to the driver:

options.addArguments("disable-infobars");

相关文章