在自動測試中,Chrome創建了大量日誌,System.setProperty("webdriver.chrome.silentOutput","true");
ChromeOptions options = new ChromeOptions();
options.addArguments(
"--disable-logging",
"--log-level=OFF",
"--silent"
);
System.setProperty(browsers.getConfigInfo(),browsers.getDriverPath());
WebDriver driver = new ChromeDriver(options);
但仍然可以看到:10:59:11.456 [Forwarding isElementDisplayed on session b316a03b20f1dc9b067b1f59ad01c1ed to remote] DEBUG org.apache.http.headers - http-outgoing-0 >> Cache-Control: no-cache
10:59:11.456 [Forwarding isElementDisplayed on session b316a03b20f1dc9b067b1f59ad01c1ed to remote] DEBUG org.apache.http.headers - http-outgoing-0 >> Host: localhost:18288
10:59:11.456 [Forwarding isElementDisplayed on session b316a03b20f1dc9b067b1f59ad01c1ed to remote] DEBUG org.apache.http.headers - http-outgoing-0 >> Connection: Keep-Alive
10:59:11.456 [Forwarding isElementDisplayed on session b316a03b20f1dc9b067b1f59ad01c1ed to remote] DEBUG org.apache.http.headers - http-outgoing-0 >> User-Agent: Apache-HttpClient/4.3.5 (java 1.5)
10:59:11.456 [Forwarding isElementDisplayed on session b316a03b20f1dc9b067b1f59ad01c1ed to remote] DEBUG org.apache.http.headers - http-outgoing-0 >> Accept-Encoding: gzip,deflate