打开dos ,找到相对文件路径:启动服务
开始---运行---cmd 打开命令提示符。
定位到…selenium-remote-control-1.0.3\selenium-server-1.0.3> 目录下。
输入:java -jar selenium-server.jar 回车。服务就启动了。
一定要看好端口是否可用。
selenium server运行时候报错---“端口被占用”,Windows平台如何查看端口占用情况
运行selenium server时候报错:
17:02:22.529 WARN - Failed to start: [email protected]:4444
Exception in thread "main" java.net.BindException: Selenium is already running o
n port 4444. Or some other service is.
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:491)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:300)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:245)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:93)
此时问题出来端口4444被进程占用,只要找到端口4444的进程,并且将进程kill掉即可。
进入windows命令(dos)
开始--运行--cmd 进入命令提示符
查看端口4444被什么软件使用。
D:\doc\selenium>netstat -aon|findstr "4444"
TCP 0.0.0.0:4444 0.0.0.0:0 LISTENING 8972
TCP [::]:4444 [::]:0 LISTENING 8972
进程号是8972,查看是javaw占用
D:\doc\selenium>tasklist|findstr "1608"
qcjavaservice.exe.exe 1608 Console 1 25,100 K
打开任务管理器中关闭即可
如果当前不能使用netstat命令,先安装相关插件
请在检查系统变量中path是否缺少[%SystemRoot%\system32]
方法:我的电脑属性/高级/环境变量/在系统变量里找到path/编辑/
将[;%SystemRoot%\system32]加到最后即可(括号里面的包括前面的分号哦),问题解决了。
一直都不能使用IE打开网址:
方法:系统变量PATH里添加IE安装位置,重启eclipse就成功了。
我的电脑-属性-高级-环境变量-系统变量-PATH,内容为【;C:\Program Files (x86)\Internet Explorer】