Rana Haram
Rana Haram

Reputation: 85

The driver executable does not exist: Selenium Firefox

I've been struggling with this for the past few hours. I'm trying to install Selenium web driver and have been running into a bunch of errors which prevent me from running the test page. I'm pretty sure my most recent issue is with this code:

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

Would really appreciate any feedback on second steps!

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();
    }
}

Upvotes: 2

Views: 10789

Answers (2)

Zoette
Zoette

Reputation: 1281

C:/Users/theone/Downloads/geckodriver 2.exe

There's a space in the path, it may work if you rename your file geckodriver2.exe.

Upvotes: 3

Anish Pillai
Anish Pillai

Reputation: 1023

You can setup Selenium with GeckoDriver either with webdriver.gecko.driver property or using environment properties. It would be good if you the latest version of Firefox, GeckoDriver and Selenium 3.0

Check out this article which provides setup using both these ways - http://automationtestinghub.com/selenium-3-0-launch-firefox-with-geckodriver/

Upvotes: 3

Related Questions