selenium常见问题(二)

来源:互联网 发布:影视公司 知乎 编辑:程序博客网 时间:2024/06/02 07:29

Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases

一直是使用的是Chrome Driven来打开Chrome浏览器执行测试,前几天selenium更新了最新版本的,解决了firefox不适配的问题,所以今天使用最新的3.0.1jar包,但是出现了如上错误:

google了一下:发现是因为版本更新的问题。

firefox48.0的新版本使用geckodriver驱动火狐浏览器,在之前的版本中google支持了火狐,但并不是火狐自己实现的。而在新版本的火狐更新了新的引擎,google原生的驱动并未实现对新引擎的支持。因此必须添加和使用geckodriver驱动来实现firefox的打开和操作。在selenium3的新特性中也seckodriver驱动进行了强制要求。

geckodriver的各种版本下载地址奉上:https://github.com/mozilla/geckodriver/releases

下载了gecko驱动后,重新启动程序,成功!


0 0