How to disable DEBUG message Selenium 4.0

Viewed 1455

I have been trying to disable DEBUG message to console, but no matter what I do, it still display on the console . I need to find a way to disable the constant logging of the HTTP request and response on the console . Code used :


System.setProperty(ChromeDriverService.CHROME_DRIVER_SILENT_OUTPUT_PROPERTY, "true");
java.util.logging.Logger.getLogger("org.openqa.selenium").setLevel(Level.SEVERE);
HashMap<String, Object> chromePrefs = new HashMap<String, Object>();
 

   chromePrefs.put("profile.default_content_settings.popups", 0);
    chromePrefs.put("download.default_directory", downloadPath);
    ChromeOptions options = new ChromeOptions();
    options.setExperimentalOption("prefs", chromePrefs);

    options.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    options.setCapability(ChromeOptions.CAPABILITY, options);
    // options.setCapability(ChromeOptions.CAPABILITY, options);
    LoggingPreferences logPrefs = new LoggingPreferences();
    logPrefs.enable(LogType.PERFORMANCE, Level.ALL);
    options.addArguments("--disable-logging");
    options.addArguments("--log-level=3");
    options.addArguments("--silent");
    options.setCapability( "goog:loggingPrefs", logPrefs );
    options.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
    options.setAcceptInsecureCerts(true);
    System.out.println("Launching Google Chrome Browser");
    //ChromeDriverManager.getInstance(CHROME).setup();
    WebDriverManager.chromedriver().setup();
    //   options.merge(cap);



   driver = new ChromeDriver(options);
      
  driver.manage().timeouts().implicitlyWait(TimeOut,TimeUnit.SECONDS);
    driver.manage().window().maximize();

on console

Request DefaultHttpRequest(decodeResult: success, version: HTTP/1.1)
POST /session HTTP/1.1
User-Agent: selenium/4.0.0 (java windows)
Content-Length: 1259
Content-Type: application/json; charset=utf-8
host: localhost:61670
accept: */*

Response DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
cache-control: no-cache
content-length: 788

[AsyncHttpClient-1-2] DEBUG org.asynchttpclient.netty.channel.ChannelManager - Adding key: http://localhost:61670 for channel [id: 0xaa9e94af, L:/127.0.0.1:63133 - R:localhost/127.0.0.1:61670]
[AsyncHttpClient-1-3] DEBUG org.asynchttpclient.netty.channel.NettyConnectListener - Using new Channel '[id: 0x60845110, L:/127.0.0.1:63145 - R:localhost/127.0.0.1:63134]' for 'GET' to '/json/version'
 [AsyncHttpClient-1-3] DEBUG org.asynchttpclient.netty.handler.HttpHandler - 

Request DefaultFullHttpRequest(decodeResult: success, version: HTTP/1.1, content: EmptyByteBufBE)
GET /json/version HTTP/1.1
User-Agent: selenium/4.0.0 (java windows)
host: localhost:63134
accept: */*

Response DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
content-length: 424

I need to find a way to remove the debug message during execution , this occur on selenium 4.0

1 Answers
Related