如何在windows中为selenium web驱动程序设置PATH变量?

时间:2016-11-02 17:01:13

标签: node.js selenium selenium-webdriver selenium-firefoxdriver

尝试运行一些旧的selenium脚本并继续坚持下去。

 The geckodriver.exe executable could not be found on the current PATH.

我正在使用Windows并尝试添加C:\ dev \ selenium \,其中我的selenium驱动程序是路径环境变量,但我觉得我没有做正确的事情。自从我触及环境变量以来,它一直是永恒的。

我使用node.js作为selenium,因此,System.setProperty回答我找不到工作。虽然我希望我能在节点中做类似的事情。

1 个答案:

答案 0 :(得分:-1)

由于最新的firefox不支持firefoxdriver,这需要在测试中更新geckodriver ...

您可以在https://github.com/mozilla/geckodriver/releases

找到最新的geckodriver

然后更新您的测试以使用新的geckodriver

System.setProperty("webdriver.gecko.driver", "PATH TO GECKO DRIVER");
DesiredCapabilities ffCapabilities = DesiredCapabilities.firefox();
ffCapabilities.setCapability("marionette",true);
WebDriver driver = new FirefoxDriver(ffCapabilities);

希望这可以帮助你!!