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

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

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

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

      Selenium chromedriver disable logging or redirect it java(Selenium chromedriver 禁用日志记录或将其重定向 java)

      1. <tfoot id='UNmSf'></tfoot>

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

            <small id='UNmSf'></small><noframes id='UNmSf'>

            • <bdo id='UNmSf'></bdo><ul id='UNmSf'></ul>

                <tbody id='UNmSf'></tbody>
              <legend id='UNmSf'><style id='UNmSf'><dir id='UNmSf'><q id='UNmSf'></q></dir></style></legend>

                本文介绍了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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)

                    <bdo id='P5xHH'></bdo><ul id='P5xHH'></ul>

                      1. <legend id='P5xHH'><style id='P5xHH'><dir id='P5xHH'><q id='P5xHH'></q></dir></style></legend>
                        1. <small id='P5xHH'></small><noframes id='P5xHH'>

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

                          <tfoot id='P5xHH'></tfoot>