1. selenium冗长的错误提示
在selenium的使用过程中,会出现很多没有的信息,这些信息让控制台和日志文件的可读性降低了很多
比如chrome在运行过程中会时不时地出现这样地内容
DevTools listening on ws://127.0.0.1:50856/devtools/browser/a9396af4-3146-4164-96ba-208a966affbc
[24412:18772:0617/090708:ERROR:ssl_client_socket_openssl.cc(1158)] handshake failed; returned -1, SSL error code 1, net_error -100
[9848:10684:1201/013233.169:ERROR:device_event_log_impl.cc(211)] [01:32:33.170] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
[9848:10684:1201/013233.169:ERROR:device_event_log_impl.cc(211)] [01:32:33.170] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)
像这样地内容已经在之前的版本精简掉了,
如果是使用webdriver-helper启动selenium的话,应该很久都没看到这些了。
这里只是为没有使用webdriver-helper的朋友说明一下

文章讨论了在使用Selenium时冗长的错误提示问题,特别是Chrome和Firefox的驱动。作者提到了webdriver-helper库可以简化这些错误,提高日志可读性。在示例中,展示了一个元素定位失败的错误,强调了关键信息——错误位置和原因。此外,文章还介绍了Selenium中的异常处理,特别是WebDriverException类,并提及了webdriver-helper的新特性,如增强PyCharm的代码提示和自动补全。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



