Road to data driven testing in webdriver java TestNg Part 2

In my previous two post, I have posted two approaches for data driven testing using java webdriver one for using testNG and another without testNg using excel file.

1. Data driven testing using java webdriver TestNg framework.
2. Road to data driven testing in webdriver java Part 1

Road to execute JavaScript in Webdriver

Some time we need to execute JavaScript function of application using webdriver or need to inject a piece of java script code to perform some action in application.

Webdriver provide a “JavascriptExecutor “class for executing java script, Here is step and code for the same.
First you need to create “JavascriptExecutor” class object.

JavascriptExecutor js = (JavascriptExecutor) driver;

Now call “executeScript()” method by passing java script code as a argument.
js .executeScript(“java script code”)

Here are some more examples.
String readyState = (String)js.executeScript("return document.readyState");

String title = (String)js.executeScript("return document.title");

String domain = (String)js.executeScript("return document.domain");

WebElement el   = (WebElement)js.executeScript("return document.getElementById('rentc');");

js.executeScript("return document.getElementById('submit').click();");

Road to switch window in webdriver

In this post I am going to show you that how to switch windows in webdriver(selenium 2). Below are some circumstances where we need to some trick to switch window.

1. Suppose you have only two windows one is parent and other is child window (opened window), your new window and parent window has similar title.

In Java:
Set windows = driver.getWindowHandles();
Iterator iter = windows.iterator();                                    
String parented  = iter.next();
driver.switchTo().window(iter.next());

In C#
String parentId = driver.WindowHandles.FirstOrDefault();
String childId = driver.WindowHandles.LastOrDefault();
driver.SwitchTo().Window(childId );

In above example I store parent Id for further switch to parent window.

Road to email configuration in Jenkins CI tool

In this post I am going to see you that how to configure email in Jenkins or Hudson CI tools so that mail send after each build.
For Jenkins mail configuration first we need to install “Email-ext “ plugin.

In Jenkins Setup:

First you need to setup sender email Id to Jenkins. For this open Jenkins  on web browser, go to “Manage Jenkins”>> Configure System .
You will see “Extended E-mail Notification” and “E-mail Notification” configure these options as I configure in below screen.


Road to create and execute Calabash Android test for beginner

In my previous post I have written how to setup calabash android and how to find element locator details using calabash console. In this post I will show you how to create calabash android test. Also I will show you, how to generate report.

Steps to write scenario:
After running command >> calabash-android gen   calabash-android automatically generates cucumber skeleton folder-structure. Now you write cucumber test scenario for your application test scenario into created “my_first.feature” file as written below:

Road to Calabash Android automation setup

Calabash is open source, cross-platform automation tool, supporting Android and iOS based native application.

Ruby Installation: download ruby version greater than 1.8.7 and less than 2.0 from link “http://rubyinstaller.org/downloads/”. Install downloaded ruby setup file into your machine.

Android SDK: download and install android sdk from link: “http://developer.android.com/sdk/index.html” for more details how to setup and install Android SDK visit link “http://developer.android.com/sdk/installing/index.html”.
After installation, setup “ANDROID-HOME” path in your system’s environment variable.
Click link "more detail" how to create android virtual device.

Road to data driven testing in webdriver java TestNg Part 1

In this post I am going to see you, how to perform data driven testing in java webdriver. In this post I read data from external excel file and use those data in test script.
For this I use java “poi” jar file to read excel file. Using poi java library I created below java class to read data from excel file and return data as a array list.

Open source automation tools for mobile automation.

Following are the some open source automation tools for the mobile application
  1. WebDriver(Selenium 2): Webdriver is most popular automation tool for  web application as well as mobile web app for android aand iOS application. Using Grid we can execute test scripts in multiple environments. For more details click here
  2. MonkeyTalk:  monkey talk automation tool support native, mobile, and hybrid iOS and Android apps - everything from simple "smoke tests" to sophisticated data-driven test suites.  It support record and playback, simulate real devices. For more details click here
  3. Frank:  Frank automation tool used for only iOS based application. It allows to write structured text test/acceptance tests/requirements (using Cucumber) and have them execute against your iOS application. Frank also includes a powerful “app inspector” (called Symbiote) that you can use to get detailed information on your running app. For more details click here
  4. Robotium: Robotium is an automation framework for android application. It is fully supported of Android native and hybrid applications. For more details click here
  5. Calabash: Calabash automation tool support for both iOS and Android based application. Like Frank automation tool it support s for BDD framework using cucumber.
  6. NativeDriver: NativeDriver is implemented by using webdriver API it supports ui of native application not web application for Android and iOS. For more details click here
  7. Zucchini: zucchini is automation framework for iOS based application. For more details click here
  8. KIF: KIF is automation testing framework for iOs based application. for more details click here
  9. Automating UI Using Xcode Instruments:  Today this most powerful to automat iOS based application.  It supports only for iOS based application, record and playback are support and java script language support for scripting. For more details click here
  10. VerifayaStudio: Verifaya studio is support Android based application and need to real device for automation. For more details click here
  11. Appium: Appium is open source mobile automation tool for android and ios application. For more details click here

I will keep posing more details on above automation tool. Please leave your comments if any open source automation tool you know for mobile application.

Road to clear input filed using sikuli java

In this post in am going to explain, how to clear input fields value using sikuli with java. As Sikuli does not provide any function to clear input field.
To clear input fields value, I use sikuli and java Robot class. First I click on input field using sikuli click() function then I use java Robot class to clear input filed. Below is code.

Robot robot = new Robot();

robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_A);
robot.keyRelease(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_BACK_SLASH);

Using above approach and code,  I clear any input field with sikuli.


Road to create virtual android device( emulator ) in windows

Here are steps to create virtual device of android in window machine.

1. Download and install Android SDK from link “download android sdk
2. After installation click on “SDK Manager.exe” from your android installed directory.


3. Check android API as per your requirement and click on install button. It will talke some time for installation.
4. After installation successful. Click on Tool>>Manage ADVs”


5. Click on new button, Enter device name and select all options from open window, click on OK buton.
6. After creating device select created device and click on “Run” button. You android vertual device is open like below screen.