selenium运行出错整理集合

1.

弹出框:Port 8005 required by Tomcat v8.5 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port numbe

参考https://blog.csdn.net/enniexiaorui/article/details/70161040

假设要查询端口8080被占用情况,在命令行下输入:netstat  -aon|findstr  "8080"

得到进程号 18104,继续输入命令: tasklist|findstr  "18104"

得到进程映像名称 WeChat.exe

Ctrl + Alt + delete 打开任务管理器,找到 名为 WeChat.exe的进程,右键,结束该进程。

这样端口被占用的问题就解决了。

2.

报错Only local connections are allowed.
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary

分析driver版本不符合所以找不到

a,浏览器版本查看https://www.cnblogs.com/jinanxiaolaohu/p/10602836.html

b,chrome版本与chromedriver对应表单https://blog.csdn.net/yoyocat915/article/details/80580066

c,驱动下载地址http://chromedriver.storage.googleapis.com/index.html

之后又查看其它介绍d

d,浏览器没调起来参考https://www.cnblogs.com/yhleng/p/9503819.html

最后发现是chrome下载的不对,它的名称为“极速浏览器”,图标长得一样,重新下载chrome后,找到对应chromedriver版本,再跑,就成功了,不过driver驱动地址是绝对路径,System.setProperty ("webdriver.chrome.driver", "D:\\tools\\jar\\chromedriver_win32 -74\\chromedriver.exe" );

左斜杠不要弄错!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值