1.因Firefox没有安装在默认路径而无法启动报的错
can't find firefox binary in PATH.Make sure firefox is installed.
solution:
add code: System.setProperty("webdriver.firefox.bin","E:\\Firefox\\firefox.exe");
and,E:\\Firefox\\firefox.exe is the path of firefox in your computer.
2.以为修改了那个错误终于可以执行成功人生第一条Java用例,然而我错了,接下来又来了个因为用了selenium3.0+Firefox而必须安装geckodriver的东西
报错如下
下载地址 https://github.com/mozilla/geckodriver/releases
网速渣渣还没下载完,不造行不行!!!明天再说。。。
两天后:
不知道为什么图片不见了呢。。。。心伤!
上面那个地址下载geckodriver总是失败的,不知道为什么,后来去找到了这个(http://download.csdn.net/detail/dongyingying518/9606829)地址下载,试验可用。
需要添加代码
System.setProperty("webdriver.firefox.marionette","E:\\Firefox\\geckodriver-v0.9.0-mac\\geckodriver");
3.这样之后我还遇到一个错误
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms
原因:selenium与火狐的版本不对应,官网下载页每个selenium client的change log对应都有写兼容的火狐版本。
这里用的是selenium3.0.0+Firefox47.0.1
亲测可用