【问题标题】:The driver executable does not exist: Selenium Firefox驱动程序可执行文件不存在:Selenium Firefox
【发布时间】:2017-04-08 02:13:11
【问题描述】:

在过去的几个小时里,我一直在为此苦苦挣扎。我正在尝试安装 Selenium Web 驱动程序并且遇到了一堆错误,这些错误阻止我运行测试页面。我很确定我最近的问题与此代码有关:

 public static void main(String[] args) throws InterruptedException{
      System.setProperty("webdriver.gecko.driver","C:/Users/theone/Downloads/geckodriver 2.exe");

非常感谢您对第二步的任何反馈!

package automationFramework;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class FirstTestCase {

    public static void main(String[] args) throws InterruptedException{
        System.setProperty("webdriver.gecko.driver","C:/Users/theone/Downloads/geckodriver 2.exe");

        // Create a new instance of the Firefox driver
        WebDriver driver = new FirefoxDriver();

        //Launch the Online Store Website
        driver.get("http://www.store.demoqa.com");

        // Print a Log In message to the screen
        System.out.println("Successfully opened the website www.Store.Demoqa.com");

        //Wait for 5 Sec
        Thread.sleep(5);

        // Close the driver
        driver.quit();
    }
}

【问题讨论】:

    标签: java selenium web driver gecko


    【解决方案1】:

    您可以使用 webdriver.gecko.driver 属性或使用环境属性来设置 Selenium 和 GeckoDriver。如果你有最新版本的 Firefox、GeckoDriver 和 Selenium 3.0 就好了

    查看这篇文章,它提供了使用这两种方式的设置 - http://automationtestinghub.com/selenium-3-0-launch-firefox-with-geckodriver/

    【讨论】:

      【解决方案2】:
      C:/Users/theone/Downloads/geckodriver 2.exe
      

      路径中有一个空格,如果你重命名文件geckodriver2.exe,它可能会起作用。

      【讨论】:

      • @RanaHaram - 如果这个答案能解决你的问题,那么请接受它作为正确答案
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-09
      • 2014-06-08
      • 2019-01-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多