Quality Testing

Quality is delighting customers

How to Import data from Excel sheet & fill those data in Facebook sign up (https://www.facebook.com/) page?

how to Import data from Excel sheet & fill those data in Facebook sign up (https://www.facebook.com/) page?

Hi Team,

I have set of multiple data in Excel sheet along with First Name,Last Name,Mobile Numbers.
I want to Import data from Excel sheet & enter those data in associated fields one after one.

can you please share your valuable thoughts!!

Thanks in advance!!

Views: 162

Reply to This

Replies to This Discussion

Hi follow the below code ,,, 

public void test() throws Exception
{
FileInputStream fi=new FileInputStream("-----give excel sheet path -----");
Workbook w=Workbook.getWorkbook(fi);
Sheet s=w.getSheet(0);
driver.get( ----give the url---);
driver.findElement(By.xpath("//td/input[3]")).click();

try
{
for (int i = 1; i < s.getRows(); i++)
{
//Read data from excel sheet

String s1 = s.getCell(1,i).getContents();
String s2 = s.getCell(2,i).getContents();
String s3 = s.getCell(3,i).getContents();

driver.findElement(By.id("firstName")).sendKeys(s1);
driver.findElement(By.id("lastname")).sendKeys(s2);
driver.findElement(By.id("mobileNumber")).sendKeys(s3);
Thread.sleep(2000);

this is one type of procedure we use another one is we can use by using data provider......i think this will helpfull to u.....:-)

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2019   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service