您的位置:首页 > 编程语言 > Java开发

用firefox 插件录制脚本转成java后,运行报错

2016-02-04 15:30 441 查看
用firefox 插件录制脚本转成java后,运行报错

java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: java.lang.RuntimeException: java.lang.RuntimeException: Firefox 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 like this:

*firefox c:\blah\firefox.exe

at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:109)

at Utiled.setUp(Utiled.java:21)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

解决办法 :

1、按照报错提示添加firefox.exe到环境 变量,结果表明不行

2、在代码行里结果显示写入

selenium = new DefaultSelenium("localhost", 4444, "*firefox C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", "https://www.baidu.com/");
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: