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

用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/");
        



你可能感兴趣的:(selenium)