Google Search

Showing posts with label Selenium. Show all posts
Showing posts with label Selenium. Show all posts

Friday, April 17, 2015

New Blog for Selenium Automation

Hello

Please refer to below blog for any assistance required in Selenium Automation. Infact, you can Request the topic you want me to write about and i would be more than happy to add a blog on the same.

http://automationtesters007.blogspot.com.au/

Happy Learning
The Software Professionals.

Sunday, February 23, 2014

Sample Code to Read data from Excel File !

Below is the sample code to read data from excel file, which i used for Selenium Automation (Selenium WebDriver)

// Code Starts here //

package mentor.qa.selenium;

import java.io.*;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;


public class ExcelRead {

public static void main (String args[]) throws Exception {

File excel = new File("F:\\Selenium\\data1.xls");
FileInputStream fis = new FileInputStream(excel);


HSSFWorkbook wb = new HSSFWorkbook(fis);
HSSFSheet ws = wb.getSheet("Input");

int rowNum = ws.getLastRowNum()+1;
int colNum = ws.getRow(0).getLastCellNum();

String[][] data  = new String[rowNum][colNum];

for (int i = 0 ; i<rowNum; i++){
HSSFRow row = ws.getRow(i);

for (int j=0;j<colNum;j++){
HSSFCell cell = row.getCell(j);
String value = cellToString(cell);
data[i][j] = value;
System.out.println("Value at position [" +i +"] [" +j +"]is " +value) ;

}

// System.out.println("Value at position [" +i +"] is " +data[i][j]) ;
}

}

public static String cellToString(HSSFCell cell) {

int type ;
Object result ;
type = cell.getCellType() ;

switch (type) {

case 0 : // numeric value in Excel
result = cell.getNumericCellValue() ;
  break ;
case 1 : // String Value in Excel
result = cell.getStringCellValue() ;
break ;
default :
throw new RuntimeException("There are no support for this type of cell") ;
}

return result.toString() ;
}
}

Saturday, October 26, 2013

Matching Patterns in Selenium

Patterns are one of the frequently used parameters by Selenese commands. Patterns allow you to describe what text you are looking for, by using special characters rather than mentioning the exact text. Some of the commands which use patterns very frequently are
·         verifyTextPresent
·         verifyTitle
·         verifyAlert
·         assertConfirmation
·         verifyPrompt
·         verifyText

Wednesday, October 23, 2013

verifyTextPresent, verifyElementPresent and verifyText Commands

“verifyTextPresent” command is used to verify that the Text is present somewhere on the webpage. It only takes one argument i.e. the text pattern to be verified.
Command
Target
Value
verifyTextpresent
Welcome to my Blog


Assertion or Verification?

To “assert” or to “verify” is a decision that a tester has to take depending on the strategy followed for testing.  There is no point in checking the text on the page if the page itself has not loaded successfully. If you are not on the expected page, you may want to abort the test and look for a root cause and fix the issue promptly. Or, you may want to run through the test suite and list all the issues on the page and then fix them all together. Effectively, an “assert” will fail the test and abort the current test case, whereas a “verify” will fail the test and continue to run the test case.

Friday, October 18, 2013

Test Your Knowlwdge of Selenium IDE - QUIZ


Working with Pop-up windows in Selenium IDE - Day 5

New windows which open from a link within a website move the actual focus from the frame you are recoding, so it is very important to move back to original website and continue recording.

Let us take an example of a website which has an embedded link, opening a new website.

Working with radio Buttons & Lists in Selenium IDE - Day 4

In this post I will discuss

1.       Example to click & verify clicked Radio Button
2.       Example to check multiple items in a list, verify if they are checked.
3.       To extract the count of items in a list


Tuesday, October 15, 2013

How to Locate Web Elements in an HTML Document in Selenium IDE - Day 3

How to Locate Web Elements in an HTML Document – Selenium IDE


There are basically 5 ways to locate web elements in an HTML Page. You can select the web elements which you believe are unique and won’t get affected by changed in the code. Below are the methods you can use:

1.       By ID
2.       By Name
3.       By Link
4.       By XPATH
5.       By CSS

Let’s discuss these one by one in detail


Saturday, October 12, 2013

Creating First Selenium Script - Day 2

The below steps will help you record your first script in Selenium:

1.       To Record a Web activity, you need to first open the Selenium IDE and start recording (By Default, when you start, Recording is automatically on)

Introduction & Installing Selenium - Day 1

Selenium is one of the most powerful open source browser automation tool available in the market to the date. Selenium is not a single tool but a suite of tools which actually evolved with time.

The Selenium tool suite comprises of

1.       Selenium IDE : A Firefox Plug-in to record and play tests (Other platforms are not supported as of now)
2.       Selenium Remote Control : Allows exporting of test suites across different OS/platforms
3.       Selenium Grid: Allows control to many Selenium Machines.