0

In my automatic test, chrome creates a lot of logs. I tried many ways, none helped. I currently have this:

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);

but still see this:

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

Any ideas ;/

JeffC
  • 22,180
  • 5
  • 32
  • 55

1 Answers1

0

To supress the Chrome and ChromeDriver related logs you can use the following solution:

  • Code Block:

    System.setProperty("webdriver.chrome.driver", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
    System.setProperty("webdriver.chrome.logfile", "C:\\Utility\\BrowserLogs\\ChromeDriver_logs.log");
    System.setProperty("webdriver.chrome.verboseLogging", "true");
    ChromeOptions options = new ChromeOptions();
    options.setCapability(LogType.BROWSER, Level.ALL);
    WebDriver driver = new ChromeDriver(options);
    driver.get("https://www.seleniumhq.org/");
    driver.quit();
    
  • Console Output (includes the minimum set of logs):

    Starting ChromeDriver 80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987@{#185}) on port 9989
    Only local connections are allowed.
    Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
    Feb 06, 2020 3:45:25 PM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Detected dialect: W3C
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • I need to check other version of ChromeDriver or Chrome Option because I not allowed to do this: options.setCapability(LogType.BROWSER, Level.ALL); – Bartosz Gurgul Feb 10 '20 at 08:25