Java Selenium chromeDriver控制台消息错误

Java Selenium chromeDriver控制台消息错误,java,selenium,ant,junit,selenium-chromedriver,Java,Selenium,Ant,Junit,Selenium Chromedriver,我正在使用ant运行我的selenium测试,我有一条消息,请参见图片: [junit]错误 [junit]正在端口xxxx上启动ChromeDriver v2.xxxxx 我尝试了以下属性,但没有成功: 我可以禁用此消息吗?有可能吗?我们需要将-silent参数传递给chromedriver以停止控制台消息。我们可以使用“withSilenttrue”方法实现这一点 使用chromedriver服务启动chromedriver,如下面的示例代码所示 示例代码: Chro

我正在使用ant运行我的selenium测试,我有一条消息,请参见图片:

[junit]错误 [junit]正在端口xxxx上启动ChromeDriver v2.xxxxx

我尝试了以下属性,但没有成功:


我可以禁用此消息吗?有可能吗?

我们需要将-silent参数传递给chromedriver以停止控制台消息。我们可以使用“withSilenttrue”方法实现这一点

使用chromedriver服务启动chromedriver,如下面的示例代码所示

示例代码:

            ChromeDriverService cdservice=new ChromeDriverService.Builder().usingDriverExecutable(new File("/path/to/chromedriver.exe"))
                    .withLogFile(new File("/path/to/chromedriver.log"))
                    .withSilent(true)
                    .usingAnyFreePort()
                    .build();

            WebDriver driver = new ChromeDriver(cdservice);
            driver.get("http://www.google.com");
我建议:

因为 1这种方式对我和 2经常被引用的ChromeDriverService.Builder为我抛出了一个编译错误

这对我来说适用于以下配置


请不要把图片放在问题中。。获取代码,并将其粘贴到问题中。您到底有什么问题?我可以禁用此消息吗?有可能吗?
            ChromeDriverService cdservice=new ChromeDriverService.Builder().usingDriverExecutable(new File("/path/to/chromedriver.exe"))
                    .withLogFile(new File("/path/to/chromedriver.log"))
                    .withSilent(true)
                    .usingAnyFreePort()
                    .build();

            WebDriver driver = new ChromeDriver(cdservice);
            driver.get("http://www.google.com");
    ChromeOptions chromeOptions = setupChromeOptions();
    System.setProperty("webdriver.chrome.logfile", "\\path\\chromedriver.log");
    System.setProperty("webdriver.chrome.driver", "\\path\\chromedriver.exe");
    System.setProperty("webdriver.chrome.args", "--disable-logging");
    System.setProperty("webdriver.chrome.silentOutput", "true");
    driver = new ChromeDriver(chromeOptions);
  selenium-chrome-driver-2.48.2.jar
  chromedriver 2.20
  selenium-java-2.48.2.jar