在《如何安装Python+selenium环境+Chrome》文章中详细说明了如何安装selenium,但是在没有网络的情况下,我们下载离线selenium安装包,手动执行安装后,可能会出现运行失败的情况。如:

我在使用中就遇到了这样的问题。
我是自己电脑可以联网,公司电脑不能连外网,而且在自己电脑上已经安装了selenium+Python环境,可以正常使用,同样的方式在公司电脑上安装Python+selenium(注:selenium是现在离线安装包安装的),导致在自己电脑上运行web自动化测试代码是OK的,在公司电脑上就会报错,如上图。
可能是离线包中没有自带安装urllib3,只能自己找其他办法解决。
方法一:(有网络的情况下)
cmd
输入:pip install urllib3

3、根据路径找到库包

4、将库包拷贝到公司电脑,进入cmd,在相应目录下执行安装即可

这样就安装成功了,再次运行web自动化代码就运行OK了!
推荐本站淘宝优惠价购买喜欢的宝贝:
本文链接:https://hqyman.cn/post/5391.html 非本站原创文章欢迎转载,原创文章需保留本站地址!
打赏

微信支付宝扫一扫,打赏作者吧~
休息一下~~