今天调用selenium库驱动chrome浏览器时遇到了这个报错

DevTools listening on ws://127.0.0.1:7100/devtools/browser/8500db96-f724-401a-a52a-d7aebcef5a6b
[79052:78172:1123/043504.039:ERROR:chrome_browser_main_extra_parts_metrics.cc(226)] crbug.com/1216328: Checking Bluetooth availability started. Please report if there is no report that this ends.
[79052:78172:1123/043504.039:ERROR:chrome_browser_main_extra_parts_metrics.cc(229)] crbug.com/1216328: Checking Bluetooth availability ended.
[79052:78172:1123/043504.043:ERROR:chrome_browser_main_extra_parts_metrics.cc(232)] crbug.com/1216328: Checking default browser status started. Please report if there is no report that this ends.
[79052:78104:1123/043504.044:ERROR:device_event_log_impl.cc(214)] [04:35:04.044] USB: usb_device_handle_win.cc:1048 Failed to read descriptor from node connection: 连到系统上的设备没有发挥作用。 (0x1F)
[79052:78104:1123/043504.049:ERROR:device_event_log_impl.cc(214)] [04:35:04.045] USB: usb_service_win.cc:392 Could not read device interface GUIDs: 系统找不到指定的文件。 (0x2)
[79052:78104:1123/043504.050:ERROR:device_event_log_impl.cc(214)] [04:35:04.050] USB: usb_device_handle_win.cc:1048 Failed to read descriptor from node connection: 连到系统上的设备没有发挥作用。 (0x1F)
[79052:78104:1123/043504.051:ERROR:device_event_log_impl.cc(214)] [04:35:04.051] USB: usb_device_handle_win.cc:1048 Failed to read descriptor from node connection: 连到系统上的设备没有发挥作用。 (0x1F)
[79052:78172:1123/043504.065:ERROR:chrome_browser_main_extra_parts_metrics.cc(236)] crbug.com/1216328: Checking default browser status ended.

解决办法:

options = webdriver.ChromeOptions()
options.add_experimental_option(‘excludeSwitches’, [‘enable-logging’])
web = webdriver.Chrome(options=options)

来自于回答:https://stackoverflow.com/questions/69418411/get-rid-of-response-message-in-python-selenium

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐