Showing posts from 2016

Code Resuablity & Maintainablility Using Action Methods in Selenium Webdriver

In this post I'm going to share kind of coding pattern which is very helpful in maintaining our automation code. This post is written insight to help beginners. We'll learn that instead of writing a linear script, we should create action methods (functions) which in general contain actions which we are going to performing on our web software.

Let's say, we have a login functionality in our software and we have to automate it. In that case we'll create a method named login and write the commands like, entering username, password and click login in that method. Now we can use that method wherever we need it in other test cases as well. Benefits of using action methods are:

Code ReusabilityBetter maintainability of code Sharing below a sample script, in which I'm entering data in a web form using action methods:

Feel free to ask queries. Happy Coding :)

Vaneesh Behl
TECHLISTICSPACE  covers Automation Testing & Tools, Mobile Automation, Selenium Webdriver, Sikuli, Robot Framework, Appium, Java, TestNG, JUNIT, JENKINS, Automation Frameworks etc.

Blog Sections:

Selenium Essentials - Become Expert in Selenium Webdriver Automation with JAVA

Folks, I thought of sharing Selenium Essentials which you must cover if you want to get expertise in Selenium Automation. It might help beginners and intermediate techies. I have divided the content in to two parts, Basic and Advanced. And I have linked the content to other web links of the blog, and planning to cover all in my future blog posts, and link all the contents periodically. Find below the Selenium Essentials:

Course content is divided into two Parts:
PART 1 - Basic Selenium which teaches you about Selenium IDE – Record and Play, Debug, Verification points and XPATH.
PART 2 - Advanced Selenium using Java which teaches Java/JUnit, Eclipse IDE, Selenium RC, Data Driven Testing, Ajax based application Testing.

1) Automation 1.1 Introduction to Automation 1.2 Test Automation of Web Application

1) Selenium Overview
2) Introduction to Selenium
3) Selenium IDE Basics
3.1 Getting Started
3.2 Selenium Commands – Selenese

4) Selenium IDE
4.1 Introduction of Selenium IDE 4.2 Insta…

Mobile IOS Automation Part 1 - Appium Configuration with MAC

In recent days I got the chance to work on a Mobile Automation assignment. I got enough time for hands-on. I didn't have much experience on mobile automation before. I thought of sharing installation steps for Appium on MAC. I pen down all the configuration details and sharing below, so others could take help from it:

MAC Configuration with Appium
List of downloads:- 1.Download Appium version 1.XX (.dmg) file      from 2.Download Appium-master from 3.Download latest android sdk. 4.Install latest Xcode 5.Update Android sdk with a)Latest API level b)Android SDK Build tools, SDK tools and SDK platform-tools from tools c)Google USB driver and Google Web-driver from extras. 6.Download safari-launcher from for mobile web testing in iPhone.

Environment variables : - 1.Open terminal 2.

Top 6 Demo Websites For Practice Selenium Webdriver

All Selenium beginners come across a question that for which website they should start writing automation code for practice. I have seen most of the beginners start writing selenium code for Gmail, Facebook, Linkedin like websites straight away and land themselves in trouble when their code don’t work more than once, reason being dynamic nature of page elements of these websites. I always discourage beginners from practicing their Selenium skills on gmail, fb like websites. These websites has dynamic page elements which are constantly changing which they intentionally implemented to discourage automation of their website to avoid fake or bot (robot) accounts. They don’t want to allow a selenium script to create an account on their website and block storage on their database as they are going to make profits from human accounts only.
So, in this post I’m going to share URLs of some demo websites which Selenium beginners can use for practice purpose. Here is the list of demo websites:


How To Take Partial Screenshot in Selenium Webdriver

Folks, sometimes we don't want to take screenshot of the full screen and inspite of the particular element due to some reasons. Reasons might be, full size images would last in huge memory storage for image directory or sometimes we need to take element specific screenshot due to test case requirement which makes more sense.

Sharing Webdriver's code snippet for taking partial screenshot below:

Feel free to share your views in comments. Enjoy and Happy Learning :)

Vaneesh Behl

To Use Dependencies with Selenium Webdriver's Test Methods in TestNG

TestNG is a testing framework developed in the lines of JUnit and NUnit, however it introduces some new functionalities that make it more powerful and easier to use. TestNG is designed to cover all categories of tests − unit, functional, end-to-end, integration, etc., and it requires JDK 5 or higher. We Automation Testers make use of TestNg to execute our tests. And it also provides some cool features in the form of parameters of annotations, one out of which I'm going to cover in this post.
                                                             TestNG provides a way to manage dependencies with annotations. For this testNg provides "dependsOnMethods" parameter for @Test annotation. If you have declared dependency of one method on second, then first of all second method will be executed and then after first method.  Below is the code snippet:

In above code, method SignIn() is dependent on OpenBrowser() and method LogOut() is dependent on SingIn and OpenBrowser method…