我有一些用Python编写的selenium代码,但问题是selenium总是在程序开始时打印出这个输出
DevTools listening on ws://ip address/devtools/browser/some numbers
由于我的计算机不支持蓝牙,我还得到以下输出:
[10376:9472:1101/171134.942:ERROR:device_event_log_impl.cc(208)] [17:11:34.941] Bluetooth: bluetooth_adapter_winrt.cc:1076 Getting Default Adapter failed.
有没有办法只消除selenium的输出?
最佳答案
我使用在SO here 上找到的以下内容
options = webdriver.ChromeOptions()
# disable some annoying debug output to console
options.add_argument('--log-level=3')
options.add_experimental_option('excludeSwitches', ['enable-logging'])
browser = webdriver.Chrome(
"C://Program Files (x86)//Google//Chrome//Application//chromedriver.exe", options=options)
关于python - 有没有一种方法或函数可以从程序中隐藏selenium的输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64634041/