!!

Welcome to Selenium Webdriver Forum

As a web user you can read and search through forum content. Once you have registered and signed you can post topics, post replies, set up watch lists, modify forum settings, and use private messaging.

Author Topic: How to run the application by fetching the data from an excel sheet to the aplct  (Read 1343 times)

reshmageo

  • Selenium User
  • *
  • Posts: 27
Hi,
I m new to Web driver.As of now i m asked to automate an application ,im stuck in between.
For the login screen, i would like to input the values for username and password through an excel sheet.
The below is the code where i give static values for the username and password

public void login() throws InterruptedException
  {
    boolean a;
   
    String fileNameRead = "C:\\testPOIRead.xls";
    System.out.println(admin);
    driver.findElement(By.id("UserName")).sendKeys("admin");
    driver.findElement(By.id("Password")).sendKeys("password");
    driver.findElement(By.id("Submit")).click();
     WebElement ans1= driver.findElement(By.id("lblLogin"));
     String ans2 = ans1.getText();
      Boolean ans="Welcome User".equals( ans2);
       writeDataToExcelFile(fileName,v1) ;
       readDataToExcelFile(fileNameRead);
   
  }

Instead of giving the actual username and password,i would like the values to be fetched from and excel sheet and then get it executed.I have no idea how to write a function and to call in the above code.
If anyone have experience in this,please share any good site where i can understand concept needed for automating the site using Web driver



tpatra

  • Selenium User
  • *
  • Posts: 6
So for that you need to use JAVA  or any language  that u know .... to retrieve the data from the xl sheet.

In Java you can use POI API ...

reshmageo

  • Selenium User
  • *
  • Posts: 27
Need a smal structure on that...... i wasnt successful in creating the function and calling it

Selenium Webdriver


tpatra

  • Selenium User
  • *
  • Posts: 6
Use the below attached file which contains all most all function by which you can play around with the Excel sheets.

reshmageo

  • Selenium User
  • *
  • Posts: 27
the java file is great..Can u plz tel me which is the function  to write data to excel sheet?

tpatra

  • Selenium User
  • *
  • Posts: 6
Have a look at all the function name starting with set and add ....

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
1416 Views
Last post April 22, 2012, 11:52:37 PM
by reshmageo
7 Replies
3674 Views
Last post April 02, 2012, 09:13:27 PM
by Rishi Machaiah
2 Replies
1974 Views
Last post April 25, 2012, 05:32:16 AM
by tpatra
2 Replies
803 Views
Last post May 01, 2012, 09:12:36 PM
by Rajat Jindal
3 Replies
1401 Views
Last post May 02, 2012, 07:35:19 PM
by Akshay Rudraksha
0 Replies
592 Views
Last post September 11, 2012, 09:23:29 AM
by weam
3 Replies
1613 Views
Last post November 20, 2012, 12:06:19 AM
by Andrew_

Review www.seleniumwebdriver.com on alexa.com