Java Selenium Chrome驱动程序 - 禁用日志记录

Med*_*wed 8 java selenium google-chrome selenium-chromedriver

我正在使用Selenium Chrome驱动程序并希望禁用日志记录,我尝试了所有现有解决方案,包括:

ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.addArguments("--log-level=3");
Run Code Online (Sandbox Code Playgroud)

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
        capabilities.setCapability("chrome.verbose", false);
Run Code Online (Sandbox Code Playgroud)

但没有一个对我有用,仍然显示此信息和警告日志:

在端口17965上启动ChromeDriver 2.25.426924(649f9b868f6783ec9de71c123212b908bf3b232e)仅允许本地连接.2017年7月25日下午7:01:16 org.openqa.selenium.remote.ProtocolHandshake createSession INFO:尝试双方言会议,假设Postel法则在远程结束时于2017年7月25日下午7:01:16 org.openqa .selenium.remote.ProtocolHandshake createSession INFO:检测到的方言:OSS

Tit*_*ius 8

这就是我一直在做的事情,它迄今为止对我有用.

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArgument("--log-level=3");
chromeOptions.addArgument("--silent");
WebDriver driver = new ChromeDriver(chromeOptions);
Run Code Online (Sandbox Code Playgroud)