How to fetch data as input from excel and use it as a input to login or some other page? Please help

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

How to fetch data as input from excel and use it as a input to login or some other page? Please help

Hemapriya Rajendran
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/hBvnqfPkBYAJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch data as input from excel and use it as a input to login or some other page? Please help

chaitanya krishna
Hi Hemapriya,
In This way you can fetch username and password from Excel and use it as per your tests...
import jxl.Sheet;
import jxl.Workbook;
public void read() throws IOException {
Workbook w;
File inputWorkbook = new File(inputFile);
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet in excel workbook
Sheet sheet = w.getSheet(0);
for (int j = 1; j < sheet.getRows(); j++) {
String username = sheet.getCell(0, j).getContents();
String password = sheet.getCell(1, j).getContents();

}

And Once the test is done.you can write the results to the excel sheet as below...
Pass your result as an argument to this method...
public void writeResult(String result) {
synchronized (result) {
try {
// use this in order to write output to text file
// File file =new File("result.txt");
// String outFileName = result + "\\" + (new
// java.sql.Date(today.getTime())) + ".xls";
String fileName = "result-"+version+".ods";
//File file = new File("result.xls");
File file = new File("/home/chaitanya/workspace/"+fileName);
BufferedWriter bufferWritter = new BufferedWriter(
new FileWriter(file.getName(), true));
bufferWritter.write(result+"\t");
bufferWritter.close();
} catch (IOException e) {
e.printStackTrace();
}
On Monday, January 28, 2013 1:13:37 PM UTC+5:30, Hemapriya Rajendran wrote:
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/hYaC4KfeJu0J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch data as input from excel and use it as a input to login or some other page? Please help

NaveenKumar Reddy R
HI Hema,

   Refer this http://functionaltestautomation.blogspot.in/2009/10/dataprovider-data-driven-testing-with.html.




On Mon, Jan 28, 2013 at 1:35 PM, chaitanya <[hidden email]> wrote:
Hi Hemapriya,
In This way you can fetch username and password from Excel and use it as per your tests...
import jxl.Sheet;
import jxl.Workbook;
public void read() throws IOException {
Workbook w;
File inputWorkbook = new File(inputFile);
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet in excel workbook
Sheet sheet = w.getSheet(0);
for (int j = 1; j < sheet.getRows(); j++) {
String username = sheet.getCell(0, j).getContents();
String password = sheet.getCell(1, j).getContents();

}

And Once the test is done.you can write the results to the excel sheet as below...
Pass your result as an argument to this method...
public void writeResult(String result) {
synchronized (result) {
try {
// use this in order to write output to text file
// File file =new File("result.txt");
// String outFileName = result + "\\" + (new
// java.sql.Date(today.getTime())) + ".xls";
String fileName = "result-"+version+".ods";
//File file = new File("result.xls");
File file = new File("/home/chaitanya/workspace/"+fileName);
BufferedWriter bufferWritter = new BufferedWriter(
new FileWriter(file.getName(), true));
bufferWritter.write(result+"\t");
bufferWritter.close();
} catch (IOException e) {
e.printStackTrace();
}
On Monday, January 28, 2013 1:13:37 PM UTC+5:30, Hemapriya Rajendran wrote:
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].

To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/hYaC4KfeJu0J.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch data as input from excel and use it as a input to login or some other page? Please help

Hemapriya Rajendran
In reply to this post by chaitanya krishna
Hi Chaitanya,

Thanks for your help.
I'll try this code and let you know the result.

Regards,
Hemapriya R

On Monday, January 28, 2013 1:35:10 PM UTC+5:30, chaitanya wrote:
Hi Hemapriya,
In This way you can fetch username and password from Excel and use it as per your tests...
import jxl.Sheet;
import jxl.Workbook;
public void read() throws IOException {
Workbook w;
File inputWorkbook = new File(inputFile);
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet in excel workbook
Sheet sheet = w.getSheet(0);
for (int j = 1; j < sheet.getRows(); j++) {
String username = sheet.getCell(0, j).getContents();
String password = sheet.getCell(1, j).getContents();

}

And Once the test is done.you can write the results to the excel sheet as below...
Pass your result as an argument to this method...
public void writeResult(String result) {
synchronized (result) {
try {
// use this in order to write output to text file
// File file =new File("result.txt");
// String outFileName = result + "\\" + (new
// java.sql.Date(today.getTime())) + ".xls";
String fileName = "result-"+version+".ods";
//File file = new File("result.xls");
File file = new File("/home/chaitanya/workspace/"+fileName);
BufferedWriter bufferWritter = new BufferedWriter(
new FileWriter(file.getName(), true));
bufferWritter.write(result+"\t");
bufferWritter.close();
} catch (IOException e) {
e.printStackTrace();
}
On Monday, January 28, 2013 1:13:37 PM UTC+5:30, Hemapriya Rajendran wrote:
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/ITtUew5nHBcJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch data as input from excel and use it as a input to login or some other page? Please help

Hemapriya Rajendran
Hi, It is working fine. Thanks for Chaitanya and Navin inputs.

Regards,
Hemapriya R

On Monday, January 28, 2013 2:53:26 PM UTC+5:30, Hemapriya Rajendran wrote:
Hi Chaitanya,

Thanks for your help.
I'll try this code and let you know the result.

Regards,
Hemapriya R

On Monday, January 28, 2013 1:35:10 PM UTC+5:30, chaitanya wrote:
Hi Hemapriya,
In This way you can fetch username and password from Excel and use it as per your tests...
import jxl.Sheet;
import jxl.Workbook;
public void read() throws IOException {
Workbook w;
File inputWorkbook = new File(inputFile);
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet in excel workbook
Sheet sheet = w.getSheet(0);
for (int j = 1; j < sheet.getRows(); j++) {
String username = sheet.getCell(0, j).getContents();
String password = sheet.getCell(1, j).getContents();

}

And Once the test is done.you can write the results to the excel sheet as below...
Pass your result as an argument to this method...
public void writeResult(String result) {
synchronized (result) {
try {
// use this in order to write output to text file
// File file =new File("result.txt");
// String outFileName = result + "\\" + (new
// java.sql.Date(today.getTime())) + ".xls";
String fileName = "result-"+version+".ods";
//File file = new File("result.xls");
File file = new File("/home/chaitanya/workspace/"+fileName);
BufferedWriter bufferWritter = new BufferedWriter(
new FileWriter(file.getName(), true));
bufferWritter.write(result+"\t");
bufferWritter.close();
} catch (IOException e) {
e.printStackTrace();
}
On Monday, January 28, 2013 1:13:37 PM UTC+5:30, Hemapriya Rajendran wrote:
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/ErVpAC_UC-wJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch data as input from excel and use it as a input to login or some other page? Please help

Karthick Nk
Hi Hemapriya,
 
Can you send me the example of input getting from excel sheet. 

On Tuesday, January 29, 2013 9:41:32 PM UTC+5:30, Hemapriya Rajendran wrote:
Hi, It is working fine. Thanks for Chaitanya and Navin inputs.

Regards,
Hemapriya R

On Monday, January 28, 2013 2:53:26 PM UTC+5:30, Hemapriya Rajendran wrote:
Hi Chaitanya,

Thanks for your help.
I'll try this code and let you know the result.

Regards,
Hemapriya R

On Monday, January 28, 2013 1:35:10 PM UTC+5:30, chaitanya wrote:
Hi Hemapriya,
In This way you can fetch username and password from Excel and use it as per your tests...
import jxl.Sheet;
import jxl.Workbook;
public void read() throws IOException {
Workbook w;
File inputWorkbook = new File(inputFile);
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet in excel workbook
Sheet sheet = w.getSheet(0);
for (int j = 1; j < sheet.getRows(); j++) {
String username = sheet.getCell(0, j).getContents();
String password = sheet.getCell(1, j).getContents();

}

And Once the test is done.you can write the results to the excel sheet as below...
Pass your result as an argument to this method...
public void writeResult(String result) {
synchronized (result) {
try {
// use this in order to write output to text file
// File file =new File("result.txt");
// String outFileName = result + "\\" + (new
// java.sql.Date(today.getTime())) + ".xls";
String fileName = "result-"+version+".ods";
//File file = new File("result.xls");
File file = new File("/home/chaitanya/workspace/"+fileName);
BufferedWriter bufferWritter = new BufferedWriter(
new FileWriter(file.getName(), true));
bufferWritter.write(result+"\t");
bufferWritter.close();
} catch (IOException e) {
e.printStackTrace();
}
On Monday, January 28, 2013 1:13:37 PM UTC+5:30, Hemapriya Rajendran wrote:
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import <a href="http://org.openqa.selenium.By" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Forg.openqa.selenium.By\46sa\75D\46sntz\0751\46usg\75AFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Forg.openqa.selenium.By\46sa\75D\46sntz\0751\46usg\75AFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg';return true;">org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4ad0e9ac-183f-41ae-8ee8-7d5296de4ae7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch data as input from excel and use it as a input to login or some other page? Please help

Abhi ram
Hi All,

Use the below java .jar in your projects for reading and writing a data from excel

POIRE

Its a Microsoft Ms-office(Excel,Ms Word,PowerPoint) files handling with Java with the help of the POI classes. This API was develop on the top of the POI library. Its has so many methods for working with the Ms-office files(Excel,Ms Word,PowerPoint). These methods will work on the both the binary(.xls, .doc, .ppt) and XML(.xlsx, .docx, .pptx). with the help of the NPOIFSFileSystem & OPCPackage classes in the POI. with these classes the reading and writing into file would be faster. In this i included so many user friendly methods with the help of POI Library.

GitHub

https://github.com/ssirekumar/POIRE
https://github.com/ssirekumar/POIRE/releases

On Thu, Oct 30, 2014 at 10:34 AM, Karthick Nk <[hidden email]> wrote:
Hi Hemapriya,
 
Can you send me the example of input getting from excel sheet. 


On Tuesday, January 29, 2013 9:41:32 PM UTC+5:30, Hemapriya Rajendran wrote:
Hi, It is working fine. Thanks for Chaitanya and Navin inputs.

Regards,
Hemapriya R

On Monday, January 28, 2013 2:53:26 PM UTC+5:30, Hemapriya Rajendran wrote:
Hi Chaitanya,

Thanks for your help.
I'll try this code and let you know the result.

Regards,
Hemapriya R

On Monday, January 28, 2013 1:35:10 PM UTC+5:30, chaitanya wrote:
Hi Hemapriya,
In This way you can fetch username and password from Excel and use it as per your tests...
import jxl.Sheet;
import jxl.Workbook;
public void read() throws IOException {
Workbook w;
File inputWorkbook = new File(inputFile);
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet in excel workbook
Sheet sheet = w.getSheet(0);
for (int j = 1; j < sheet.getRows(); j++) {
String username = sheet.getCell(0, j).getContents();
String password = sheet.getCell(1, j).getContents();

}

And Once the test is done.you can write the results to the excel sheet as below...
Pass your result as an argument to this method...
public void writeResult(String result) {
synchronized (result) {
try {
// use this in order to write output to text file
// File file =new File("result.txt");
// String outFileName = result + "\\" + (new
// java.sql.Date(today.getTime())) + ".xls";
String fileName = "result-"+version+".ods";
//File file = new File("result.xls");
File file = new File("/home/chaitanya/workspace/"+fileName);
BufferedWriter bufferWritter = new BufferedWriter(
new FileWriter(file.getName(), true));
bufferWritter.write(result+"\t");
bufferWritter.close();
} catch (IOException e) {
e.printStackTrace();
}
On Monday, January 28, 2013 1:13:37 PM UTC+5:30, Hemapriya Rajendran wrote:
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4ad0e9ac-183f-41ae-8ee8-7d5296de4ae7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CALZtNwA1rJ4BfgefFiL9fX1LhtRMvPZHLQGs%2Bd2svffLGtVHJg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch data as input from excel and use it as a input to login or some other page? Please help

rajeev singh-2
Hi SSire Kumar,


I am new to automation, and have downloaded both standalone and standalone doc and imported into my referenced library, now how can i use this to read a particular cell data of my excel sheet. my excel sheet is imported into eclipse and having under a folder in xlsx extension. i have to read data from row 2, column 3.


Regards,
Rajeev

On Tuesday, January 13, 2015 at 11:33:42 AM UTC+5:30, Ssire Kumar wrote:
Hi All,

Use the below java .jar in your projects for reading and writing a data from excel

POIRE

Its a Microsoft Ms-office(Excel,Ms Word,PowerPoint) files handling with Java with the help of the POI classes. This API was develop on the top of the POI library. Its has so many methods for working with the Ms-office files(Excel,Ms Word,PowerPoint). These methods will work on the both the binary(.xls, .doc, .ppt) and XML(.xlsx, .docx, .pptx). with the help of the NPOIFSFileSystem & OPCPackage classes in the POI. with these classes the reading and writing into file would be faster. In this i included so many user friendly methods with the help of POI Library.

GitHub

<a href="https://github.com/ssirekumar/POIRE" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fssirekumar%2FPOIRE\46sa\75D\46sntz\0751\46usg\75AFQjCNHzpwb7DppshXLB7aT19DdBywaYpA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fssirekumar%2FPOIRE\46sa\75D\46sntz\0751\46usg\75AFQjCNHzpwb7DppshXLB7aT19DdBywaYpA&#39;;return true;">https://github.com/ssirekumar/POIRE
<a href="https://github.com/ssirekumar/POIRE/releases" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fssirekumar%2FPOIRE%2Freleases\46sa\75D\46sntz\0751\46usg\75AFQjCNE3gZLAx-b_ZRXvMB8IhKLaZAhylg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fssirekumar%2FPOIRE%2Freleases\46sa\75D\46sntz\0751\46usg\75AFQjCNE3gZLAx-b_ZRXvMB8IhKLaZAhylg&#39;;return true;">https://github.com/ssirekumar/POIRE/releases

On Thu, Oct 30, 2014 at 10:34 AM, Karthick Nk <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="N9Jm53_x2SUJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">karthi...@...> wrote:
Hi Hemapriya,
 
Can you send me the example of input getting from excel sheet. 


On Tuesday, January 29, 2013 9:41:32 PM UTC+5:30, Hemapriya Rajendran wrote:
Hi, It is working fine. Thanks for Chaitanya and Navin inputs.

Regards,
Hemapriya R

On Monday, January 28, 2013 2:53:26 PM UTC+5:30, Hemapriya Rajendran wrote:
Hi Chaitanya,

Thanks for your help.
I'll try this code and let you know the result.

Regards,
Hemapriya R

On Monday, January 28, 2013 1:35:10 PM UTC+5:30, chaitanya wrote:
Hi Hemapriya,
In This way you can fetch username and password from Excel and use it as per your tests...
import jxl.Sheet;
import jxl.Workbook;
public void read() throws IOException {
Workbook w;
File inputWorkbook = new File(inputFile);
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet in excel workbook
Sheet sheet = w.getSheet(0);
for (int j = 1; j < sheet.getRows(); j++) {
String username = sheet.getCell(0, j).getContents();
String password = sheet.getCell(1, j).getContents();

}

And Once the test is done.you can write the results to the excel sheet as below...
Pass your result as an argument to this method...
public void writeResult(String result) {
synchronized (result) {
try {
// use this in order to write output to text file
// File file =new File("result.txt");
// String outFileName = result + "\\" + (new
// java.sql.Date(today.getTime())) + ".xls";
String fileName = "result-"+version+".ods";
//File file = new File("result.xls");
File file = new File("/home/chaitanya/workspace/"+fileName);
BufferedWriter bufferWritter = new BufferedWriter(
new FileWriter(file.getName(), true));
bufferWritter.write(result+"\t");
bufferWritter.close();
} catch (IOException e) {
e.printStackTrace();
}
On Monday, January 28, 2013 1:13:37 PM UTC+5:30, Hemapriya Rajendran wrote:
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import <a href="http://java.net" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fjava.net\46sa\75D\46sntz\0751\46usg\75AFQjCNHvsroZ72hHEGjeEAhG-RVyDevYYw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fjava.net\46sa\75D\46sntz\0751\46usg\75AFQjCNHvsroZ72hHEGjeEAhG-RVyDevYYw&#39;;return true;">java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import <a href="http://org.openqa.selenium.By" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Forg.openqa.selenium.By\46sa\75D\46sntz\0751\46usg\75AFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Forg.openqa.selenium.By\46sa\75D\46sntz\0751\46usg\75AFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;">org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="N9Jm53_x2SUJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">selenium-user...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="N9Jm53_x2SUJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/4ad0e9ac-183f-41ae-8ee8-7d5296de4ae7%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/4ad0e9ac-183f-41ae-8ee8-7d5296de4ae7%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/4ad0e9ac-183f-41ae-8ee8-7d5296de4ae7%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/4ad0e9ac-183f-41ae-8ee8-7d5296de4ae7%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/69058b49-c1e3-499b-b14a-b60b0bb305dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch data as input from excel and use it as a input to login or some other page? Please help

Jegadeesh mani
Hi rajeev singh,

please go through the below link..

http://www.guru99.com/creating-keyword-hybrid-frameworks-with-selenium.html

Thanks,
Jegadeesh

On Fri, Aug 28, 2015 at 1:02 PM, rajeev singh <[hidden email]> wrote:
Hi SSire Kumar,


I am new to automation, and have downloaded both standalone and standalone doc and imported into my referenced library, now how can i use this to read a particular cell data of my excel sheet. my excel sheet is imported into eclipse and having under a folder in xlsx extension. i have to read data from row 2, column 3.


Regards,
Rajeev

On Tuesday, January 13, 2015 at 11:33:42 AM UTC+5:30, Ssire Kumar wrote:
Hi All,

Use the below java .jar in your projects for reading and writing a data from excel

POIRE

Its a Microsoft Ms-office(Excel,Ms Word,PowerPoint) files handling with Java with the help of the POI classes. This API was develop on the top of the POI library. Its has so many methods for working with the Ms-office files(Excel,Ms Word,PowerPoint). These methods will work on the both the binary(.xls, .doc, .ppt) and XML(.xlsx, .docx, .pptx). with the help of the NPOIFSFileSystem & OPCPackage classes in the POI. with these classes the reading and writing into file would be faster. In this i included so many user friendly methods with the help of POI Library.

GitHub

https://github.com/ssirekumar/POIRE
https://github.com/ssirekumar/POIRE/releases

On Thu, Oct 30, 2014 at 10:34 AM, Karthick Nk <[hidden email]> wrote:
Hi Hemapriya,
 
Can you send me the example of input getting from excel sheet. 


On Tuesday, January 29, 2013 9:41:32 PM UTC+5:30, Hemapriya Rajendran wrote:
Hi, It is working fine. Thanks for Chaitanya and Navin inputs.

Regards,
Hemapriya R

On Monday, January 28, 2013 2:53:26 PM UTC+5:30, Hemapriya Rajendran wrote:
Hi Chaitanya,

Thanks for your help.
I'll try this code and let you know the result.

Regards,
Hemapriya R

On Monday, January 28, 2013 1:35:10 PM UTC+5:30, chaitanya wrote:
Hi Hemapriya,
In This way you can fetch username and password from Excel and use it as per your tests...
import jxl.Sheet;
import jxl.Workbook;
public void read() throws IOException {
Workbook w;
File inputWorkbook = new File(inputFile);
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet in excel workbook
Sheet sheet = w.getSheet(0);
for (int j = 1; j < sheet.getRows(); j++) {
String username = sheet.getCell(0, j).getContents();
String password = sheet.getCell(1, j).getContents();

}

And Once the test is done.you can write the results to the excel sheet as below...
Pass your result as an argument to this method...
public void writeResult(String result) {
synchronized (result) {
try {
// use this in order to write output to text file
// File file =new File("result.txt");
// String outFileName = result + "\\" + (new
// java.sql.Date(today.getTime())) + ".xls";
String fileName = "result-"+version+".ods";
//File file = new File("result.xls");
File file = new File("/home/chaitanya/workspace/"+fileName);
BufferedWriter bufferWritter = new BufferedWriter(
new FileWriter(file.getName(), true));
bufferWritter.write(result+"\t");
bufferWritter.close();
} catch (IOException e) {
e.printStackTrace();
}
On Monday, January 28, 2013 1:13:37 PM UTC+5:30, Hemapriya Rajendran wrote:
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4ad0e9ac-183f-41ae-8ee8-7d5296de4ae7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/69058b49-c1e3-499b-b14a-b60b0bb305dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CADrrHivg0Y0A_SnKYA23FqGhRdv3tnmYb7dRsUcpz9hxSe0uuA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch data as input from excel and use it as a input to login or some other page? Please help

chethan kumar
hi Hemapriya Rajendran

please send full code ...login page code ..data takes from excel sheet ..

Thanks 
chethan

On Friday, August 28, 2015 at 1:09:17 PM UTC+5:30, Jegadeesh mani wrote:
Hi rajeev singh,

please go through the below link..

<a href="http://www.guru99.com/creating-keyword-hybrid-frameworks-with-selenium.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fwww.guru99.com%2Fcreating-keyword-hybrid-frameworks-with-selenium.html\46sa\75D\46sntz\0751\46usg\75AFQjCNERxGJGnHEZdTy0LVabcGgppQfA7g&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fwww.guru99.com%2Fcreating-keyword-hybrid-frameworks-with-selenium.html\46sa\75D\46sntz\0751\46usg\75AFQjCNERxGJGnHEZdTy0LVabcGgppQfA7g&#39;;return true;">http://www.guru99.com/creating-keyword-hybrid-frameworks-with-selenium.html

Thanks,
Jegadeesh

On Fri, Aug 28, 2015 at 1:02 PM, rajeev singh <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="FU9apx23BDMJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rajeevkum...@...> wrote:
Hi SSire Kumar,


I am new to automation, and have downloaded both standalone and standalone doc and imported into my referenced library, now how can i use this to read a particular cell data of my excel sheet. my excel sheet is imported into eclipse and having under a folder in xlsx extension. i have to read data from row 2, column 3.


Regards,
Rajeev

On Tuesday, January 13, 2015 at 11:33:42 AM UTC+5:30, Ssire Kumar wrote:
Hi All,

Use the below java .jar in your projects for reading and writing a data from excel

POIRE

Its a Microsoft Ms-office(Excel,Ms Word,PowerPoint) files handling with Java with the help of the POI classes. This API was develop on the top of the POI library. Its has so many methods for working with the Ms-office files(Excel,Ms Word,PowerPoint). These methods will work on the both the binary(.xls, .doc, .ppt) and XML(.xlsx, .docx, .pptx). with the help of the NPOIFSFileSystem & OPCPackage classes in the POI. with these classes the reading and writing into file would be faster. In this i included so many user friendly methods with the help of POI Library.

GitHub

<a href="https://github.com/ssirekumar/POIRE" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fssirekumar%2FPOIRE\46sa\75D\46sntz\0751\46usg\75AFQjCNHzpwb7DppshXLB7aT19DdBywaYpA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fssirekumar%2FPOIRE\46sa\75D\46sntz\0751\46usg\75AFQjCNHzpwb7DppshXLB7aT19DdBywaYpA&#39;;return true;">https://github.com/ssirekumar/POIRE
<a href="https://github.com/ssirekumar/POIRE/releases" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fssirekumar%2FPOIRE%2Freleases\46sa\75D\46sntz\0751\46usg\75AFQjCNE3gZLAx-b_ZRXvMB8IhKLaZAhylg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\75https%3A%2F%2Fgithub.com%2Fssirekumar%2FPOIRE%2Freleases\46sa\75D\46sntz\0751\46usg\75AFQjCNE3gZLAx-b_ZRXvMB8IhKLaZAhylg&#39;;return true;">https://github.com/ssirekumar/POIRE/releases

On Thu, Oct 30, 2014 at 10:34 AM, Karthick Nk <[hidden email]> wrote:
Hi Hemapriya,
 
Can you send me the example of input getting from excel sheet. 


On Tuesday, January 29, 2013 9:41:32 PM UTC+5:30, Hemapriya Rajendran wrote:
Hi, It is working fine. Thanks for Chaitanya and Navin inputs.

Regards,
Hemapriya R

On Monday, January 28, 2013 2:53:26 PM UTC+5:30, Hemapriya Rajendran wrote:
Hi Chaitanya,

Thanks for your help.
I'll try this code and let you know the result.

Regards,
Hemapriya R

On Monday, January 28, 2013 1:35:10 PM UTC+5:30, chaitanya wrote:
Hi Hemapriya,
In This way you can fetch username and password from Excel and use it as per your tests...
import jxl.Sheet;
import jxl.Workbook;
public void read() throws IOException {
Workbook w;
File inputWorkbook = new File(inputFile);
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet in excel workbook
Sheet sheet = w.getSheet(0);
for (int j = 1; j < sheet.getRows(); j++) {
String username = sheet.getCell(0, j).getContents();
String password = sheet.getCell(1, j).getContents();

}

And Once the test is done.you can write the results to the excel sheet as below...
Pass your result as an argument to this method...
public void writeResult(String result) {
synchronized (result) {
try {
// use this in order to write output to text file
// File file =new File("result.txt");
// String outFileName = result + "\\" + (new
// java.sql.Date(today.getTime())) + ".xls";
String fileName = "result-"+version+".ods";
//File file = new File("result.xls");
File file = new File("/home/chaitanya/workspace/"+fileName);
BufferedWriter bufferWritter = new BufferedWriter(
new FileWriter(file.getName(), true));
bufferWritter.write(result+"\t");
bufferWritter.close();
} catch (IOException e) {
e.printStackTrace();
}
On Monday, January 28, 2013 1:13:37 PM UTC+5:30, Hemapriya Rajendran wrote:
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import <a href="http://java.net" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fjava.net\46sa\75D\46sntz\0751\46usg\75AFQjCNHvsroZ72hHEGjeEAhG-RVyDevYYw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fjava.net\46sa\75D\46sntz\0751\46usg\75AFQjCNHvsroZ72hHEGjeEAhG-RVyDevYYw&#39;;return true;">java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import <a href="http://org.openqa.selenium.By" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Forg.openqa.selenium.By\46sa\75D\46sntz\0751\46usg\75AFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Forg.openqa.selenium.By\46sa\75D\46sntz\0751\46usg\75AFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;">org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/4ad0e9ac-183f-41ae-8ee8-7d5296de4ae7%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/4ad0e9ac-183f-41ae-8ee8-7d5296de4ae7%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/4ad0e9ac-183f-41ae-8ee8-7d5296de4ae7%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/4ad0e9ac-183f-41ae-8ee8-7d5296de4ae7%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="FU9apx23BDMJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">selenium-user...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="FU9apx23BDMJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">seleniu...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/selenium-users/69058b49-c1e3-499b-b14a-b60b0bb305dc%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/69058b49-c1e3-499b-b14a-b60b0bb305dc%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/selenium-users/69058b49-c1e3-499b-b14a-b60b0bb305dc%40googlegroups.com?utm_medium\75email\46utm_source\75footer&#39;;return true;">https://groups.google.com/d/msgid/selenium-users/69058b49-c1e3-499b-b14a-b60b0bb305dc%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a4689718-6472-41cb-bc28-86ce66c09bf1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch data as input from excel and use it as a input to login or some other page? Please help

Krishnan Mahadevan
Chethan,
What exactly is your query ? Can you please add a bit more context ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Wed, Jan 20, 2016 at 11:10 AM, chethan kumar <[hidden email]> wrote:
hi Hemapriya Rajendran

please send full code ...login page code ..data takes from excel sheet ..

Thanks 
chethan

On Friday, August 28, 2015 at 1:09:17 PM UTC+5:30, Jegadeesh mani wrote:
Hi rajeev singh,

please go through the below link..

http://www.guru99.com/creating-keyword-hybrid-frameworks-with-selenium.html

Thanks,
Jegadeesh

On Fri, Aug 28, 2015 at 1:02 PM, rajeev singh <[hidden email]> wrote:
Hi SSire Kumar,


I am new to automation, and have downloaded both standalone and standalone doc and imported into my referenced library, now how can i use this to read a particular cell data of my excel sheet. my excel sheet is imported into eclipse and having under a folder in xlsx extension. i have to read data from row 2, column 3.


Regards,
Rajeev

On Tuesday, January 13, 2015 at 11:33:42 AM UTC+5:30, Ssire Kumar wrote:
Hi All,

Use the below java .jar in your projects for reading and writing a data from excel

POIRE

Its a Microsoft Ms-office(Excel,Ms Word,PowerPoint) files handling with Java with the help of the POI classes. This API was develop on the top of the POI library. Its has so many methods for working with the Ms-office files(Excel,Ms Word,PowerPoint). These methods will work on the both the binary(.xls, .doc, .ppt) and XML(.xlsx, .docx, .pptx). with the help of the NPOIFSFileSystem & OPCPackage classes in the POI. with these classes the reading and writing into file would be faster. In this i included so many user friendly methods with the help of POI Library.

GitHub

https://github.com/ssirekumar/POIRE
https://github.com/ssirekumar/POIRE/releases

On Thu, Oct 30, 2014 at 10:34 AM, Karthick Nk <[hidden email]> wrote:
Hi Hemapriya,
 
Can you send me the example of input getting from excel sheet. 


On Tuesday, January 29, 2013 9:41:32 PM UTC+5:30, Hemapriya Rajendran wrote:
Hi, It is working fine. Thanks for Chaitanya and Navin inputs.

Regards,
Hemapriya R

On Monday, January 28, 2013 2:53:26 PM UTC+5:30, Hemapriya Rajendran wrote:
Hi Chaitanya,

Thanks for your help.
I'll try this code and let you know the result.

Regards,
Hemapriya R

On Monday, January 28, 2013 1:35:10 PM UTC+5:30, chaitanya wrote:
Hi Hemapriya,
In This way you can fetch username and password from Excel and use it as per your tests...
import jxl.Sheet;
import jxl.Workbook;
public void read() throws IOException {
Workbook w;
File inputWorkbook = new File(inputFile);
try {
w = Workbook.getWorkbook(inputWorkbook);
// Get the first sheet in excel workbook
Sheet sheet = w.getSheet(0);
for (int j = 1; j < sheet.getRows(); j++) {
String username = sheet.getCell(0, j).getContents();
String password = sheet.getCell(1, j).getContents();

}

And Once the test is done.you can write the results to the excel sheet as below...
Pass your result as an argument to this method...
public void writeResult(String result) {
synchronized (result) {
try {
// use this in order to write output to text file
// File file =new File("result.txt");
// String outFileName = result + "\\" + (new
// java.sql.Date(today.getTime())) + ".xls";
String fileName = "result-"+version+".ods";
//File file = new File("result.xls");
File file = new File("/home/chaitanya/workspace/"+fileName);
BufferedWriter bufferWritter = new BufferedWriter(
new FileWriter(file.getName(), true));
bufferWritter.write(result+"\t");
bufferWritter.close();
} catch (IOException e) {
e.printStackTrace();
}
On Monday, January 28, 2013 1:13:37 PM UTC+5:30, Hemapriya Rajendran wrote:
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4ad0e9ac-183f-41ae-8ee8-7d5296de4ae7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/69058b49-c1e3-499b-b14a-b60b0bb305dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a4689718-6472-41cb-bc28-86ce66c09bf1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CANikZLneZWzpuC_dk6nbwg8k3sLK3yajjF%2BK7TFVs3%3D0tT5Ohg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch data as input from excel and use it as a input to login or some other page? Please help

purvang talatiya
In reply to this post by Hemapriya Rajendran
Hello Rajendran,

Hope you are doing well,

I want help from you for webdriver, I want a code for multiple email and password can be verified from excel file and give me as well in excel with status column that weather it is pass or fail.



On Monday, January 28, 2013 at 1:13:37 PM UTC+5:30, Hemapriya Rajendran wrote:
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import <a href="http://org.openqa.selenium.By" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.openqa.selenium.By\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.openqa.selenium.By\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;">org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3f1a2da5-f082-479c-8a85-9319235cac12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch data as input from excel and use it as a input to login or some other page? Please help

somasekhar patil
In reply to this post by Hemapriya Rajendran
Hi ,
I used this code but i m not getting hw to fetch data from Excel file,where exectly we have to make changes plz let me know 
1)I have changed URL and Excel path then what i have to change .



package package1;



import java.io.File;

import java.io.FileInputStream;

import java.io.IOException;


import org.apache.poi.xssf.usermodel.XSSFCell;

import org.apache.poi.xssf.usermodel.XSSFRow;

import org.apache.poi.xssf.usermodel.XSSFSheet;

import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class yoda2 {


public static void main(String[] args) { 
// Launch FireFox WebDriver driver = new FirefoxDriver();
System.setProperty("webdriver.chrome.driver","./drivers/chromedriver.exe");
WebDriver driver;

driver=new ChromeDriver();
driver.get("http://192.168.1.200:91/");
driver.manage().window().maximize();
// Enter YODA URL 
    

// Enter UserID 
driver.findElement(By.name("userid")).sendKeys("xx3517"); 

 // Enter Password driver.findElement(By.name("password")).sendKeys("123123a"); 

 // Click on Submit button after entering User ID and Password driver.findElement(By.name("btnSubmit")).click(); 

// Click on Remind Me later driver.findElement(By.name("successOK")).click(); 

 try { File file = new File("E:\\MFB_NEW_WS\\new3\\Soma\\Excelfile\\Login_ExcelSheet.xlsx"); 

 FileInputStream iFile = new FileInputStream(file);

 XSSFWorkbook wb = new XSSFWorkbook(iFile);      

XSSFSheet sheet = wb.getSheet("Sheet1"); 

int rowCount = sheet.getLastRowNum();

System.out.println("the no of rows are : " + rowCount);

for (int row=1; row<=rowCount; row++)
{ String location = sheet.getRow(row).getCell(0).getStringCellValue();

 String activity = sheet.getRow(row).getCell(1).getStringCellValue();

 int order=(int) sheet.getRow(row).getCell(2).getNumericCellValue();

 System.out.println(location + " , " + activity + " , " +order );
 }

 iFile.close();

 }

 catch (IOException e) { e.printStackTrace();
 } 

// Click on Search Button on YODA home page 

driver.findElement(By.className("MenuBarItemSubmenu")).click(); 

driver.findElement(By.xpath("//*[text()='Fulfillment Details']")).click();

driver.findElement(By.name("location")).sendKeys(location); 

driver.findElement(By.name("activity")).sendKeys(activity); 

driver.findElement(By.name("orderID")).sendKeys(order); 

driver.findElement(By.id("fulfillment_submit")).click(); } }




Advance Thanks 
Somu




On Monday, January 28, 2013 at 1:13:37 PM UTC+5:30, Hemapriya Rajendran wrote:
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import <a href="http://org.openqa.selenium.By" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.openqa.selenium.By\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Forg.openqa.selenium.By\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEfZQPnvt4Ug_Aq50kJ-TWrQ8CZyg&#39;;return true;">org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/d1a744a9-a16d-4181-9213-b3da30d0fc30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to fetch data as input from excel and use it as a input to login or some other page? Please help

somasekhar patil
Hi 
Please help me out how to fetch the data from excel for login .


Thanks and regards
Somu

Somasekhar Patil



On Wed, Apr 18, 2018 at 5:06 PM, somasekhar patil <[hidden email]> wrote:
Hi ,
I used this code but i m not getting hw to fetch data from Excel file,where exectly we have to make changes plz let me know 
1)I have changed URL and Excel path then what i have to change .



package package1;



import java.io.File;

import java.io.FileInputStream;

import java.io.IOException;


import org.apache.poi.xssf.usermodel.XSSFCell;

import org.apache.poi.xssf.usermodel.XSSFRow;

import org.apache.poi.xssf.usermodel.XSSFSheet;

import org.apache.poi.xssf.usermodel.XSSFWorkbook;


import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class yoda2 {


public static void main(String[] args) { 
// Launch FireFox WebDriver driver = new FirefoxDriver();
System.setProperty("webdriver.chrome.driver","./drivers/chromedriver.exe");
WebDriver driver;

driver=new ChromeDriver();
driver.get("http://192.168.1.200:91/");
driver.manage().window().maximize();
// Enter YODA URL 
    

// Enter UserID 
driver.findElement(By.name("userid")).sendKeys("xx3517"); 

 // Enter Password driver.findElement(By.name("password")).sendKeys("123123a"); 

 // Click on Submit button after entering User ID and Password driver.findElement(By.name("btnSubmit")).click(); 

// Click on Remind Me later driver.findElement(By.name("successOK")).click(); 

 try { File file = new File("E:\\MFB_NEW_WS\\new3\\Soma\\Excelfile\\Login_ExcelSheet.xlsx"); 

 FileInputStream iFile = new FileInputStream(file);

 XSSFWorkbook wb = new XSSFWorkbook(iFile);      

XSSFSheet sheet = wb.getSheet("Sheet1"); 

int rowCount = sheet.getLastRowNum();

System.out.println("the no of rows are : " + rowCount);

for (int row=1; row<=rowCount; row++)
{ String location = sheet.getRow(row).getCell(0).getStringCellValue();

 String activity = sheet.getRow(row).getCell(1).getStringCellValue();

 int order=(int) sheet.getRow(row).getCell(2).getNumericCellValue();

 System.out.println(location + " , " + activity + " , " +order );
 }

 iFile.close();

 }

 catch (IOException e) { e.printStackTrace();
 } 

// Click on Search Button on YODA home page 

driver.findElement(By.className("MenuBarItemSubmenu")).click(); 

driver.findElement(By.xpath("//*[text()='Fulfillment Details']")).click();

driver.findElement(By.name("location")).sendKeys(location)

driver.findElement(By.name("activity")).sendKeys(activity)

driver.findElement(By.name("orderID")).sendKeys(order); 

driver.findElement(By.id("fulfillment_submit")).click(); } }




Advance Thanks 
Somu




On Monday, January 28, 2013 at 1:13:37 PM UTC+5:30, Hemapriya Rajendran wrote:
Assume, I have the excel sheet which contains the input values for my application. While testing the application with selenium webdriver,
It has to fetch the data from excel (for eg: Username and password) and apply it in the login page of the application and send the result back whether it is pass or fail.
I am using TestNG with selenium webdriver.

Please help me I am new to using selenium.

This is my code for entering user name and password and click on login button


import java.net.MalformedURLException;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class CoreMeasureSTK {
            WebDriver driver;
            WebElement userName;
            WebElement password;

            @BeforeTest
            public void start() throws MalformedURLException {
                        driver = new FirefoxDriver();
                        driver.manage().timeouts().implicitlyWait(10000, TimeUnit.SECONDS);
            }

  @Test
  public void Test() {
              driver.get("url");
                      
                          // Entering user name and password
                        userName = driver.findElement(By.id("Login1_UserName"));
                        userName.sendKeys("qczxn");
                        //String expectedName = userName.getAttribute("value");              
                        password = driver.findElement(By.id("Login1_Password"));
                        password.sendKeys("Change@123");
                        //String expectedPassword = password.getAttribute("value");                      
                        driver.findElement(By.id("Login1_LoginButton")).click();

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/d1a744a9-a16d-4181-9213-b3da30d0fc30%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAO6YJjO2ny9PWRsLx9d3SgPQphKC4rb%2B72S_QQNQcfZ1Z3kDDA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.