我正在使用Chrome Canary运行python脚本(下面的完整脚本链接)进行selenium测试.测试似乎运行正常,但是,控制台上显示了大量错误/警告/信息消息.
有没有办法压制这些消息?我试过:chrome_options.add_argument(" - silent"),但没有帮助.我无法找到合适的解决方案.感谢任何帮助.
Python脚本:此处提供的示例脚本
Python:3.6.3 Selenium:3.6.0 Chrome Canary:63.0.3239.5(64位)ChromeDriver:2.33

简单问题:如何在使用Python绑定的Selenium时完全禁用日志记录,ex代码如下:
browser = webdriver.Chrome()
Run Code Online (Sandbox Code Playgroud)
我尝试过这样的事情:
options = webdriver.ChromeOptions();
options.add_argument('--log-level 3')
browser = webdriver.Chrome(chrome_options=options)
Run Code Online (Sandbox Code Playgroud)
甚至:
options = webdriver.ChromeOptions();
options.add_argument('--disable-logging')
browser = webdriver.Chrome(chrome_options=options)
Run Code Online (Sandbox Code Playgroud)
但是仍然会在每次新的测试运行中出现'chromedriver.log'文件.
我正在尝试从远程webdriver实例获取一些性能日志信息.我正在使用Python Selenium绑定.
从我所看到的,这是我应该能够获得的信息.认为它可能只适用于ChromeDriver.我目前正在使用FireFox,但如果它能获得我想要的信息,可以轻松切换.
但是,我是Python新手(但学习!)和Python的功能词典(当用于性能记录时)的文档似乎有点受限(或者我的google-fu今天早上很弱).
我发现了以下内容:
DesiredCapabilities caps = DesiredCapabilities.chrome();
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable("performance", Level.INFO);
caps.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
driver = new RemoteWebDriver("http://localhost:9515", caps);
Run Code Online (Sandbox Code Playgroud)
看起来它应该做我需要的.但它是Java.我不太确定如何将其转换为Python.假设它是可能的.
有任何想法吗?
python logging selenium selenium-chromedriver remotewebdriver