gpt4 book ai didi

java - 如何在 selenium webdriver 3.0 beta 中使用 geckodriver?

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:22:13 35 4
gpt4 key购买 nike

如何将 geckodriver 用于 selenium webdriver 3.0 beta 版。当我像这样实例化 Firefox 时:

WebDriver driver = new FirefoxDriver();
System.setProperty("webdriver.gecko.driver", "//lib//geckodriver");
driver.get("/");

我得到错误:

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.

最佳答案

得到解决方案:

System.setProperty("webdriver.gecko.driver", "pathTogeckodriver");
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
WebDriver driver = new FirefoxDriver(capabilities);

关于java - 如何在 selenium webdriver 3.0 beta 中使用 geckodriver?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38692208/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com