赞
踩
使用chrome_driver自动化操作Google浏览器,调试的时候没有提示,但是编译后就提示一些错误的解决方法:
1、提示 ERROR:ssl_client_socket_impl.cc(975)] handshake failed; returned -1, SSL error code 1, net_error -101:
添加:
options.add_argument('verify=False') # 跳过SSL证书验证
2、提示 USB: usb_device_win.cc:95 Failed to read descriptors from \\?\usb#vid_0e8d&pid_201d#0123456789abcdef#{a5dcbf10-6530-11d2-901f-00c04fb951ed}.
添加:
options.add_experimental_option("excludeSwitches", ['enable-automation', 'enable-logging']) # 防止打印一些无用的日志
可以两个同时加上。
3、禁用“浏览器正在被自动化程序控制的提示”的方法如下:(有些教程只写了第一行,实测不生效。)
- options.add_argument('--disable-infobars')
- options.add_argument('--disable-extensions')
- options.add_argument('--disable-popup-blocking')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。