I'm using the Selenium Chromedriver with Java. I don't want it to output any logs/messages in the console. Therefore I used the following code:
System.setProperty("webdriver.chrome.silentOutput", "true");
System.setProperty(ChromeDriverService.CHROME_DRIVER_SILENT_OUTPUT_PROPERTY, "true");
Logger.getLogger("org.openqa.selenium").setLevel(Level.OFF);
However, I'm still getting a single message: "ChromeDriver was started successfully". How can I prevent this message?
You can redirect the output to a file or just discard it:
// redirect console output from chromedriver to the file chromedriver_log.txt in the target folder
DriverService.Builder<ChromeDriverService, ChromeDriverService.Builder> serviceBuilder = new ChromeDriverService.Builder();
ChromeDriverService chromeDriverService = serviceBuilder.build();
chromeDriverService.sendOutputTo(new FileOutputStream("target/chromedriver_log.txt", true));
webDriver = new ChromeDriver(chromeDriverService, options);
If you want to just discard the output then use NullOutputStream.NULL_OUTPUT_STREAM
insted off new FileOutputStream("target/chromedriver_log.txt", true)