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

本文详细解析了在使用Selenium进行自动化测试时遇到的FF3.6与selenium1.0.1不兼容的问题,并提供了解决方法。同时,还解决了找不到Firefox的情况,通过重新安装FF并指定其绝对路径来解决此问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误信息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/");

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值