Dear All,
I'm trying to read mix of Numeric and String values from excel (and feed into application). I'm getting the exception "[Utils] [ERROR] [Error] java.lang.IllegalStateException: Cannot get a text value from a numeric cell"
Could you help me out to sort out the issue please?
Kind regards,
Karthik
package webExcel;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import Lib.ExcelDataConfig;
public class toolscalculator {
WebDriver driver;
@Test(dataProvider = "DonTool")
public void Logsite(int sdNumber, String stype, String sgender, int sweight, int sheight) throws InterruptedException
{
System.setProperty("webdriver.gecko.driver", "C:\\geckodriver.exe");
FirefoxOptions options = new FirefoxOptions();
options.setBinary("C:\\Users\\karaja\\AppData\\Local\\Mozilla Firefox\\firefox.exe");
driver = new FirefoxDriver(options);
driver.get("http://");
driver.findElement(By.id ("_dNumber")).sendKeys(sdNumber);
driver.findElement(By.id("type")).sendKeys(stype);
driver.findElement(By.id ("gender")).sendKeys(sgender);
driver.findElement(By.id("weight")).sendKeys(sweight);
driver.findElement(By.id("height")).sendKeys(sheight);
driver.findElement(By.id("calculate")).click();
Thread.sleep(5000);
System.out.println (" Success ");
}
@DataProvider (name = "DonTool")
public Object[][] passDat()
{
ExcelDataConfig config=new ExcelDataConfig("C:\\Users\\karaja\\Desktop\\donotools.xls");
int rows=config.getRowCount(0);
System.out.println(rows);
Object [][] data=new Object[rows][2];
for (int i=0; i<rows; i++)
{
data[i][0]=config.getData(0, i, 0);
data[i][1]=config.getData(0, i, 1);
}
return data;
}
@AfterSuite
public void closeBrowser(){
driver.quit();
}
}