0
 package excelprog.TestDDT;
    import org.testng.annotations.Test;
    import TestUtil.TestUtil;
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.concurrent.TimeUnit;
    import org.openqa.selenium.By;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.WebElement;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.testng.annotations.BeforeClass;
    import org.testng.annotations.BeforeMethod;
    import org.testng.annotations.DataProvider;
    public class DataDrivenTest {
        static WebDriver driver;
        @BeforeClass
        public static void Initialise()
        {
            System.setProperty("WebDriver.chrome.driver", "C:\\Users\\Priyanka\\selenium-java-3.0.0-beta2\\chromedriver.exe");
            driver =  new ChromeDriver();
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);

            driver.get("http://ec2-52-74-219-106.ap-southeast-1.compute.amazonaws.com/sso/login/?siteid=MTASITE&request_url=http%3A%2F%2Fec2-52-76-192-207.ap-southeast-1.compute.amazonaws.com%2F");

        System.out.println("hi");
        }   
        @DataProvider
        public Iterator<Object[]> getTestdata()
        {   
            ArrayList<Object[]> testData = TestUtil.getDataFromExcel();
            return testData.iterator();
                }

        @Test(dataProvider="getTestdata")

        public void loginmodule(String emailid, String password)
        {
        //  driver.close();
        //  driver =  new ChromeDriver();
            //driver.manage().window().maximize();

            /*
            try {
                Thread.sleep(5000);
            } catch (Exception e) {
                e.printStackTrace();
            }
            */
            WebElement username = driver.findElement(By.id("LoginForm_username"));
            username.sendKeys(emailid);
            username.click();

            WebElement passwordl = driver.findElement(By.id("LoginForm_password"));
            passwordl.sendKeys(password);
            passwordl.click();
            WebElement submitlink = driver.findElement(By.id("login_page_login_btn"));  
            submitlink.submit();
            }
    }

I am getting following error:

FAILED CONFIGURATION:

@BeforeClass Initialise
java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
    at com.google.common.base.Preconditions.checkState(Preconditions.java:199)
    at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)
    at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32)
    at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)
    at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)
    at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:88)
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Welcome to stack overflow, please visit https://stackoverflow.com/help/how-to-ask page. – Venkat Apr 11 '18 at 09:40
  • Possible duplicate of [java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property](https://stackoverflow.com/questions/46587942/java-lang-illegalstateexception-the-path-to-the-driver-executable-must-be-set-b) – undetected Selenium Apr 11 '18 at 10:28
  • @Venkat Please don't abuse the highlight markup to highlight the error stack trace else the error logs gets truncated and debugging becomes difficult. – undetected Selenium Apr 11 '18 at 10:32
  • 1
    @DebanjanB okay and thanks for the edit. – Venkat Apr 11 '18 at 10:33

1 Answers1

0

You have a typo in your setProperty line.

It should be webdriver not Webdriver

System.setProperty("webDriver.chrome.driver", "C:\\Users\\Priyanka\\selenium-java-3.0.0-beta2\\chromedriver.exe");
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Afgan
  • 1,022
  • 10
  • 32
  • @PriyankaKale if its working then mark it correct so that other can take advantage.Thanks – Afgan Apr 11 '18 at 10:07