mercredi 30 mars 2016

ChromeDriver cannot navigate to URL in eclipse

So I am very new to cucumber but I'm trying to use the GoogleDriver to go to a certain URL but I receive and error. Here is the first line:

java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see http://ift.tt/GBbVJI. The latest version can be downloaded from http://ift.tt/1hV5c2G at com.google.common.base.Preconditions.checkState(Preconditions.java:177)

My code:

package cucumber.features;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;

public class AddToList {

    WebDriver driver = null;

    @Given("^I am on Todo site$")
    public void onSite() throws Throwable {
        driver = new ChromeDriver();
        driver.navigate().to("http://localhost");
        System.out.println("on todo site");

    }

    @When("^Enter a task in todo textbox$")
    public void enterTask() throws Throwable {
        driver = new ChromeDriver();
        driver.findElement(By.name("task")).sendKeys("Test Unit Using Cucumber");
        ;
        System.out.println("task entered");
    }

    @Then("^I click on add to todo$")
    public void clickAddToTodo() throws Throwable {
        driver = new ChromeDriver();
        driver.findElement(By.xpath("//input[@value='Add to Todo' and @type='button']"));
        System.out.println("add button clicked");

    }

}

Aucun commentaire:

Enregistrer un commentaire