eclipse中运行Selenium遇到的问题

1.   java.lang.NoClassDefFoundError:

 

解决方法:eclipse的java工程中导入selenium-java-2.44.0selenium-2.44.0libs中所有的jar包.

2.    在win7  IE8下

Selenium脚本中通过selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://10.88.15.51:8080/");的方式设置浏览器
以java -jar selenium-server.jar不带参数的方式启动selenium server

运行脚本时,系统会报以下的错误:

 

问题出现原因:

1.在WIN7 IE8的环境下时,IE被设置为“Protected Mode”,导致selenium无法打开IE.(protected mode 是在英文操作系统下的名字,中文操作系统,大家自己对应吧)

2.selenium在IE中运行比较慢,如果用google的chrome会快一点。

解决方法:

1.将IE的“Protected Mode”设置取消。Internet Options->Security->" Internet " icon->Enable Protected Mode(英文版)

2.采用其他浏览器, Google Chrome 或者 Firefox 3.0

3. Could not contact Selenium Server:

 

问题出现原因:

    1. 没有启动selenium server

解决方法:

         1.cmd窗口启动selenium server服务

原文地址:https://www.cnblogs.com/zhuhaiying/p/4923678.html