使用 chrome canary 执行 selenium python 脚本时如何抑制控制台错误/警告/信息消息 [英] How to suppress console error/warning/info messages when executing selenium python scripts using chrome canary
问题描述
我正在使用 Chrome Canary 运行 python 脚本(下面的完整脚本链接)进行硒测试.测试似乎运行良好,但是控制台上显示了许多错误/警告/信息消息.
I am running python script (complete script link below) for selenium test using Chrome Canary. The test seems to be running fine, however, there are lots of error/warning/info messages displayed on the console.
有没有办法抑制这些消息?我努力了:chrome_options.add_argument("--silent"),但没有帮助.我无法找到正确的解决方案.感谢任何帮助.
Is there a way to suppress these messages? I have tried: chrome_options.add_argument("--silent"), but does not help. I am not able to find the right solution. Appreciate any help.
Python 脚本:此处提供的示例脚本
Python:3.6.3硒:3.6.0Chrome 金丝雀:63.0.3239.5(64 位)铬驱动程序:2.33
Python: 3.6.3 Selenium: 3.6.0 Chrome Canary: 63.0.3239.5 (64 bit) ChromeDriver : 2.33
推荐答案
试试options.add_argument('log-level=3')
.
log-level:
Sets the minimum log level.
Valid values are from 0 to 3:
INFO = 0,
WARNING = 1,
LOG_ERROR = 2,
LOG_FATAL = 3.
default is 0.
这篇关于使用 chrome canary 执行 selenium python 脚本时如何抑制控制台错误/警告/信息消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!