How to execute Selenium Chrome WebDriver in silent mode?

前端 未结 8 1592
广开言路
广开言路 2020-11-30 06:54

When using Chrome Selenium-WebDriver, it will output diagnostic output when the servers are started:

Started ChromeDriver (v2.0) on port 9515

相关标签:
8条回答
  • 2020-11-30 07:21

    For me the only thing that worked for

       selenium-chrome-driver-2.48.2.jar
       chromedriver 2.20
       selenium-java-2.48.2.jar
    

    was

       ChromeOptions options = new ChromeOptions();
       System.setProperty("webdriver.chrome.args", "--disable-logging");
       System.setProperty("webdriver.chrome.silentOutput", "true");
       driver = new ChromeDriver(options);
    
    0 讨论(0)
  • 2020-11-30 07:21

    To run Chrome browser with Selenium in console in completely silent mode, you should use this snippet:

    options = Options()
    options.headless = True
    options.add_experimental_option("excludeSwitches", ["enable-logging"])
    

    That trick will suppress any console message from either the Selenium driver or the browser itself, including the first message DevTools listening on ws://127.0.0.1 at the very start.

    0 讨论(0)
提交回复
热议问题