Here is my Code:au
package Mypackage;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.support.ui.Select;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.apache.xmlbeans.impl.xb.xmlconfig.ConfigDocument.Config;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
@Test(dataProvider="Rahul")
public class jh{
WebDriver driver;
public void loginjh(String loginId ,String password)throws InterruptedException {
}
{
System.setProperty("webdriver.gecko.driver","C:\\Users\\Selenium2017\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("URL");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElement(By.name("loginId")).sendKeys("loginId");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.findElement(By.name("password")).sendKeys("password");
driver.findElement(By.name("btnSubmit")).click();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
@AfterMethod
public void tearDown()
{
driver.quit();
}
@DataProvider(name="Rahul")
public Object[][] TestData()
***Excel Dataconfig config = new Excel Dataconfig("Excel Path");
int rows = Config.getRowcount(0);
Object[][] data = new Object [rows][2];
for(int i=o;i<rows;i++)
{
data[i][0]=config.getData(0,i,0);
data[i][1]=config.getData(0,i,1);
}
return data;