Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Selenium Chrome driver - Disable logging

I'm working with Selenium Chrome driver and want to disable logging, I'v tried all existing solutions including :

ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.addArguments("--log-level=3");

and

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
        capabilities.setCapability("chrome.verbose", false);

but none worked for me, still having this Info and warning log showing up :

Starting ChromeDriver 2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e) on port 17965 Only local connections are allowed. Jul 25, 2017 7:01:16 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end Jul 25, 2017 7:01:16 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: OSS

like image 240
Med Dhaker Abdeljawed Avatar asked Jul 25 '17 18:07

Med Dhaker Abdeljawed


People also ask

How do I disable Selenium logging?

Set the browserstack. seleniumLogs capability to false to disable Selenium logs. A string. Defaults to true .

How do I stop Selenium from loading in Chrome?

We can stop a page loading with Selenium webdriver in Chrome browser by using the JavaScript Executor. Selenium can execute JavaScript commands with the help of the executeScript command. To stop a page loading, the command window. stop() is passed as a parameter to the executeScript method.

What is the difference between WebDriver and Chrome driver?

A ChromeDriver is a separate executable or a standalone server that Selenium WebDriver uses to launch Google Chrome. Here, a WebDriver refers to a collection of APIs used to automate the testing of web applications.


1 Answers

This is what I have been doing and it has worked so far for me.

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArgument("--log-level=3");
chromeOptions.addArgument("--silent");
WebDriver driver = new ChromeDriver(chromeOptions);
like image 195
TitusLucretius Avatar answered Sep 19 '22 08:09

TitusLucretius