<tfoot id='jSokM'></tfoot>

  • <small id='jSokM'></small><noframes id='jSokM'>

      1. <i id='jSokM'><tr id='jSokM'><dt id='jSokM'><q id='jSokM'><span id='jSokM'><b id='jSokM'><form id='jSokM'><ins id='jSokM'></ins><ul id='jSokM'></ul><sub id='jSokM'></sub></form><legend id='jSokM'></legend><bdo id='jSokM'><pre id='jSokM'><center id='jSokM'></center></pre></bdo></b><th id='jSokM'></th></span></q></dt></tr></i><div id='jSokM'><tfoot id='jSokM'></tfoot><dl id='jSokM'><fieldset id='jSokM'></fieldset></dl></div>

          <bdo id='jSokM'></bdo><ul id='jSokM'></ul>
      2. <legend id='jSokM'><style id='jSokM'><dir id='jSokM'><q id='jSokM'></q></dir></style></legend>

        Selenium chromedriver 禁用日志记录或将其重定向 ja

        时间:2023-09-28

          <tbody id='nUSQo'></tbody>
        <tfoot id='nUSQo'></tfoot>

        • <small id='nUSQo'></small><noframes id='nUSQo'>

          1. <legend id='nUSQo'><style id='nUSQo'><dir id='nUSQo'><q id='nUSQo'></q></dir></style></legend>

              <i id='nUSQo'><tr id='nUSQo'><dt id='nUSQo'><q id='nUSQo'><span id='nUSQo'><b id='nUSQo'><form id='nUSQo'><ins id='nUSQo'></ins><ul id='nUSQo'></ul><sub id='nUSQo'></sub></form><legend id='nUSQo'></legend><bdo id='nUSQo'><pre id='nUSQo'><center id='nUSQo'></center></pre></bdo></b><th id='nUSQo'></th></span></q></dt></tr></i><div id='nUSQo'><tfoot id='nUSQo'></tfoot><dl id='nUSQo'><fieldset id='nUSQo'></fieldset></dl></div>
                  <bdo id='nUSQo'></bdo><ul id='nUSQo'></ul>

                  本文介绍了Selenium chromedriver 禁用日志记录或将其重定向 java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试在迷你网络爬虫中使用 selenium 来获取页面源.我的输出日志被 selenium 日志入侵,有没有办法完全禁用日志记录或只是以某种方式将其重定向到/dev/null?

                  I am trying to use selenium in a mini web crawler to get the page source. My output log is invaded by selenium logs, is there a way to totally disable the logging or just redirect it in someway to /dev/null?

                  日志消息如下:

                  Starting ChromeDriver 2.43.600233 
                  (523efee95e3d68b8719b3a1c83051aa63aa6b10d) on port 1628
                  Only local connections are allowed.
                  ott 24, 2018 7:52:01 PM org.openqa.selenium.remote.ProtocolHandshake createSession
                  INFORMAZIONI: Detected dialect: OSS
                  

                  我通过以下方式调用驱动程序:

                  I am calling the driver in the following way:

                  WebDriver driver = null;
                              try {
                              System.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedriver");
                              ChromeOptions chromeOptions = new ChromeOptions();
                              chromeOptions.setBinary("/usr/bin/chromium");
                              chromeOptions.addArguments("--headless");
                              chromeOptions.addArguments("--silent");
                              chromeOptions.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.IGNORE);
                              driver = new ChromeDriver(chromeOptions);
                              /*FirefoxBinary firefoxBinary = new FirefoxBinary();
                              firefoxBinary.addCommandLineOptions("--headless");
                              System.setProperty("webdriver.gecko.driver", "/usr/local/bin/geckodriver");
                              System.setProperty(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE, "true");
                              System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "/dev/null");
                  
                  
                              FirefoxOptions firefoxOptions = new FirefoxOptions();
                              firefoxOptions.setBinary(firefoxBinary);
                              FirefoxDriver driver = new FirefoxDriver(firefoxOptions);*/
                              if(driver!=null) {
                              driver.get(link);
                  

                  推荐答案

                  好吧,我终于摆脱了那些无用的日志记录.这就是我所做的.
                  使用:
                  System.setProperty("webdriver.chrome.silentOutput", "true");

                  要摆脱 chromedriver 日志:

                  Ok i have managed to finally get rid of that useless loggings. Here is what i did.
                  Use:
                  System.setProperty("webdriver.chrome.silentOutput", "true");

                  To get rid of chromedriver logs:

                  启动 ChromeDriver 2.43.600233(523efee95e3d68b8719b3a1c83051aa63aa6b10d) 在端口 1628 上仅限本地允许连接.

                  Starting ChromeDriver 2.43.600233 (523efee95e3d68b8719b3a1c83051aa63aa6b10d) on port 1628 Only local connections are allowed.


                  并使用:java.util.logging.Logger.getLogger("org.openqa.selenium").setLevel(Level.OFF);
                  摆脱硒日志:


                  And use: java.util.logging.Logger.getLogger("org.openqa.selenium").setLevel(Level.OFF);
                  To get rid of selenium logs:

                  2018 年 2 月 24 日下午 7:52:01 org.openqa.selenium.remote.ProtocolHandshakecreateSession INFORMAZIONI:检测到的方言:OSS

                  ott 24, 2018 7:52:01 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFORMAZIONI: Detected dialect: OSS

                  这篇关于Selenium chromedriver 禁用日志记录或将其重定向 java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:“ExpectedConditions.visibilityOfElementLocated"之间的 下一篇:org.openqa.selenium.WebDriverException:转发新会话时出错

                  相关文章

                  最新文章

                  <legend id='Dlfy7'><style id='Dlfy7'><dir id='Dlfy7'><q id='Dlfy7'></q></dir></style></legend>
                • <tfoot id='Dlfy7'></tfoot>
                    <bdo id='Dlfy7'></bdo><ul id='Dlfy7'></ul>
                • <i id='Dlfy7'><tr id='Dlfy7'><dt id='Dlfy7'><q id='Dlfy7'><span id='Dlfy7'><b id='Dlfy7'><form id='Dlfy7'><ins id='Dlfy7'></ins><ul id='Dlfy7'></ul><sub id='Dlfy7'></sub></form><legend id='Dlfy7'></legend><bdo id='Dlfy7'><pre id='Dlfy7'><center id='Dlfy7'></center></pre></bdo></b><th id='Dlfy7'></th></span></q></dt></tr></i><div id='Dlfy7'><tfoot id='Dlfy7'></tfoot><dl id='Dlfy7'><fieldset id='Dlfy7'></fieldset></dl></div>

                    1. <small id='Dlfy7'></small><noframes id='Dlfy7'>