Can anyone please suggest me how can I read an excel-sheet in my local-drive say"C:\company_names.xls" and populate into the text boxes present in a webpage.
I will explain the test case scenario as below:
1)The webpage should first open in a Firefox. 2)The left navigation should be clicked "companylist" 3)Then a drop-down value name company list(by default) should be selected. 4)Then create button should be click which takes the page to another page which has two text boxes with names say "Company names" and company products" 5)The excelsheet with entries for these two textboxes is in the local drive "C:\text.xls". This excel sheet has total number of 100 records. 6)Each of the two entries companynames and company products should be fetched from excel sheet and populated in the textboxes in the webpage and then a submit button should be clicked. 7)Then another submit button.
I am able to create the automation by hard-coding two sample values for the first entry.Can anyone help me out how to read the value from excelsheet and populate in the text boxes of the webpage?
I have pasted below the hardcoded example that i have done so far, please help me out in how to approach with the excelsheet reading and populating of the data into webpage.
public void submit()throws Exception
{
selenium.start();
selenium.setSpeed("1000");
selenium.open("URL");
selenium.windowFocus();
selenium.windowMaximize();
selenium.click("link=companylist");
selenium.waitForPageToLoad("30000");
selenium.select("//select[@name='comp_id']","label=company");
selenium.waitForPageToLoad("30000");
selenium.click("name=open");
selenium.waitForPageToLoad("30000");
selenium.type("id=company_names", "test5");
selenium.type("id=company_products", "test6");
selenium.click("css=input.button");
selenium.waitForPageToLoad("30000");
selenium.click("name=action");
selenium.waitForPageToLoad("30000");
selenium.click("name=action");
selenium.waitForPageToLoad("30000");
}
public void tearDown() throws Exception
{
selenium.close();
selenium.stop();
selenium.refresh();
}