Selenimu运行脚本时遇到的与FF浏览器相关问题小结

来源:互联网 发布:java中单引号和双引号 编辑:程序博客网 时间:2024/06/05 11:25

错误信息1:

FAILED CONFIGURATION: @BeforeClass setUp
java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: Unable to delete file C:\Users\ADMINI~1\AppData\Local\Temp\customProfileDir9cf2c422885b4bb683e8f836a80a58be\parent.lock

原因:ff3.6与selenium1.0.1不兼容,服务器端使用selenium1.0.2以上的版本即可


错误信息2:

java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: java.lang.RuntimeException: Firefox 3 could not be found in the path!
Please add the directory containing ''firefox.exe'' to your PATH environment
variable, or explicitly specify a path to Firefox 3 like this:
*firefox3c:\blah\firefox.exe

java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: org.openqa.selenium.server.browserlaunchers.InvalidBrowserExecutableException: The specified path to the browser executable is invalid.  

原因:找不到FF,不能打开浏览器
解决:1、把ff重新安装一次,安装路径默认,不要修改
            2、在脚本中增加详细的浏览器绝对路径地址:

selenium = new DefaultSelenium("localhost", 4444, "*firefox D:\Program Files\Mozilla Firefox\firefox.exe","http://istock.jrj.com.cn/");

原创粉丝点击