1

When I run my app java is always writing things like:

Starting ChromeDriver 2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5) on port 19943
Only local connections are allowed.
сен 27, 2018 11:18:11 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS

How can I prevent it? I don't need it now.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

2

These logs you mentioned are the default ChromeDriver startup logs. As the log level is not configured until a session is created you don't have any control over the generation of these logs.

Moving forward, during Test Execution to see lesser logs you can simply pass --silent argument to the chromedriver server as follows:

  • Code Block:

      import org.openqa.selenium.WebDriver;
      import org.openqa.selenium.chrome.ChromeDriver;
    
      public class A_Chrome_General
      {
          public static void main(String[] args) 
          {
              System.setProperty("webdriver.chrome.driver", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
              System.setProperty("webdriver.chrome.silentLogging", "true");
              WebDriver driver = new ChromeDriver();
              driver.get("https://stackoverflow.com");
              System.out.println("Page Title is : "+driver.getTitle());
              driver.quit();
          }
      }
    

References

You can find a couple of relevant detailed discussions in:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352