Learn Selenium Automation Testing


Sunday, 6 May 2018

What is the default port number used by hub in Selenium?

03:17:00 0
What is the default port number used by hub in Selenium?
What is the default port number used by hub in Selenium,While working with Selenium Grid,we require to configure Selenium Hub to connect to different machines and it will have default port number.

What is the default port number used by hub in Selenium?

What is the default port number used by hub in Selenium?

a. 4444
b. 2222
c. 3434
d. 2290

ANSWER : 4444

Thursday, 3 May 2018

Difference Between Assertion and Verification in Selenium

19:41:00 0
Difference Between Assertion and Verification in Selenium
In this Difference Between Assertion and Verification in Selenium post you will learn exact difference and when to use assert and verify command in selenium scripts,Selenium Verify command will not stop Test execution of Test cases if verification Test fails.

It will log an error/defect and continue with Test Cases execution of remaining  test cases. We use Selenium verify commands in Selenium IDE when you still want to proceed with Test execution of test case even if expected output is not matched for a test steps.  

Difference Between Assertion and Verification in Selenium

Selenium Assertion command will stop Test execution of Test cases if verification point fails. It will log an error/defect and will not continue with Test Cases execution of remaining Test case scripts. We can use assertions in Test scenarios where there is no point to continue further Test Execution if expected result is not matching with actual test results. 

It is very simple. You can Use assertions when you want to stop Test case execution , if expected Test results is not matched with actual test results and you can use verification points when you still want to continue test script execution of a test cases if expected test results is not matched with actual test results.

Trending Posts:

Handle Authentication using Selenium

Sunday, 22 April 2018

L&T Infotech Selenium Webdriver Interview Questions

02:37:00 0
L&T Infotech Selenium Webdriver Interview Questions
L&T Infotech Selenium Webdriver Interview Questions and Answers with examples.L&T Infotech is located in Pune and Hiring for Mumbai Location for Selenium Test Engineer with Selenium ,TestNG,Appium Mobile App Testing,Rest API testing using Soap UI skills.

 L&T Infotech Selenium Webdriver Interview Questions

L&T Infotech Selenium Webdriver Interview Questions

What is the difference between list and set?


It is an Interface and it will display the list data in which order it is inserted.


Set is an interface and it will display the list values in random way not in a insertion order.If want to display in inserted order then we can go for TreeSet<> interface.

How will you switch to other window?

driver.switchTo().Window(window id);



What is the return type of driver.findelement/driver.getwindowhandles()?

findElements() takes argument of type of By class and returns all the matching web elements present in currently loaded web page only. This method returns all matching web elements in a List of type WebElement which is an interface in Collection framework.

findElement() method takes argument of By class and returns first matching web element on currently loaded web page. If passed locator is matching with multiple web elements, it will return only first matching web element.

What is the difference between Private and Protected?

private hides from other classes within the package. public exposes to classes outside the package. protected is a version of public restricted only to subclasses.


Like you'd think, only the class in which it is declared can see it.

Package Private

Can only be seen and used by the package in which it was declared. This is the default in Java.


Package Private + can be seen by subclasses or package member.


Everyone can see it.
How will you achieve dynamic polymorphism?

Dynamic Polymorphism also called as RunTime Polymorphism.


What is inheritance and encapsulation?


Inheritance in java is one object can access all parent object properties and values from another class.


Encapsulation is nothing but binding data and code into a single unit for example package  which contains number of classes,those classes are binding together into a single package.

Can you override static methods?

We cannot override static methods. Static methods are belogs to class, not belongs to object. Inheritance will not be applicable for class members.

We can declare static methods with same signature in subclass, but it is not considered overriding as there won’t be any run-time polymorphism. Hence the answer is ‘No’.

Can main method be overloaded?

Yes, you can overload main method in Java. But the program doesn't execute the overloaded main method when you run your program, you have to call the overloaded main method from the actual main method.

that means main method acts as an entry point for the java interpreter to start the execute of the application. where as a loaded main need to be called from main.


class Simple{  

  public static void main(int a){  

  public static void main(String args[]){  
  System.out.println("main() method invoked");  

What is Singleton?

Singleton is a Class in Java ,which is having only one Object at a time.Singleton class purpose is to control object creation,limiting the number of objects to one object.

1.Constrctor as a private
2.Need Static method with return type object

What is collections in Java?

Ans:collections is a class,where Collection is an interface.
A collection is simply a object that groups multiple elements into a single unit.

What is nested class?

Java Programming allow to creates a class under another class.
How will you call a protected method in a nested class?

In a web page, how will you ensure that page has been loaded completely?

JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("return document.readyState").toString().equals("complete");

What is the difference between build and perform method in Actions Class?

The build() method is used compile all the listed actions into a single step.
we have to use build() when we are performing sequence of operations and no need to use only if we are performing single action.

example where build() required
Actions builder = new Actions(driver);

in the above code we are performing more than one operations so we have to use build() to compile all the actions into a single step

example where build is not required

WebElement draggable = driver.findElement(By.id("draggable")); 
WebElement droppable = driver.findElement(By.id("droppable")); 
new Actions(driver).dragAndDrop(draggable, droppable).perform();
in the above code we are performing just a single operations so no need to use build()


What are different annotations in TestNG?

@BeforeSuite: The annotated method will be run before all tests in this suite have run. 
@AfterSuite: The annotated method will be run after all tests in this suite have run. 
@BeforeTest: The annotated method will be run before any test method belonging to the classes inside the <test> tag is run. 
@AfterTest: The annotated method will be run after all the test methods belonging to the classes inside the <test> tag have run. 
@BeforeGroups: The list of groups that this configuration method will run before. This method is guaranteed to run shortly before the first test method that belongs to any of these groups is invoked. 
@AfterGroups: The list of groups that this configuration method will run after. This method is guaranteed to run shortly after the last test method that belongs to any of these groups is invoked. 
@BeforeClass: The annotated method will be run before the first test method in the current class is invoked. 
@AfterClass: The annotated method will be run after all the test methods in the current class have been run. 
@BeforeMethod: The annotated method will be run before each test method. 
@AfterMethod: The annotated method will be run after each test method.

What is the difference between before method and before test?

@BeforeMethod: The annotated method will be run before each test method. 

@BeforeTest: The annotated method will be run before any test method belonging to the classes inside the <test> tag is run. 

How will you display the character count in a string "Steve Jobs" by ignoring space on between?

String test = "Steve Jobs";
System.out.println(test.replace(" ", "").length());

Replacing empty space with 0 character
What is a constructor and when will you use this and super in a constructor?

If you want to call a constructor from parent class, what will you do?

How will you run your tests using Data Driven Framework?

What are static variables and methods?

Static Variables

Variables declared with static keyword is known as Static Variables and it is a class level variables.
Static variables are shared among all the instances of class,this type of variables are useful in memory management.


public static String username="admministrator";
public static int mobileNo="2222222222";

Static Method

Static Methods are the methods in Java that can be called without creating an object of class.They are referrenced by the class name itself .
No need to create any object to access static methods from another class .


Class 1:

public class Student{

public static String student_Name=" ";

public static void studentsNames(String name){

student_Name = name;


Class 2:

Accessing class 1 static method 

public class CSEStudents{


//You can access student_Name method with creating object as below

Student obj = new Student();





How will you handle Alerts in selenium?

Alert obj = driver.switchTo.alert();
String alertText=obj.getText();

if (alertText.equals("Enter valid Username")){

System.out.println("Alert is not present- giving exception");

How will you handle a file upload window using Selenium?

There's no API for WebDriver that would allow you to work with browser dialog's,we can use below code to file uploading.

String filePath = System.getProperty("user.dir") + "/src/res/test.pdf;

Can I define one class into another class?

Yes ,those are nested class

two types

1.Static class
2.Inner Classes

What are different types of modifiers present in Java?


How will you make a build using Jenkins?

1.Click on New Item in Jenkins Dashboard
2.Enter Item Name
3.Select Free Style Project
4.Click on OK
5.Enter Description 
6.Select check box Delete Build before Build Starts in Build Environment
7.Select Windows Batch Command in Build Tab

Enter Command as below to run selenium Test Scripts:

set projectpath=E:\Selenium_Practice
cd %projectpath%
set classpath=%projectpath%\bin;%projectpath%\libs\*
java org.testng.TestNG %projectpath%\testng.xml

8.Select Publish Test Results in Post-Build Actions Tab

Enter TestNG XML report pattern as " **/testng-results.xml"

9.Click on Save button

How will you install ReportNG in your project?

1.Download ReportNG jar files
2.Add those jar files to project build path
3.In textng.xml file add listners as below

        <listener class-name="org.uncommons.reportng.HTMLReporter"/>
        <listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>        
How will you control data using XML?

We can use textng.xml file to pass the data for parameterization

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="TestSuite" thread-count="3" >
<parameter name="author" value="Selenium WebDriver" />
<parameter name="searchKey" value="America" />
<test name="testGuru">
<parameter name="searchKey" value="India" />
<class name="parameters.ParameterWithTestNGXML">

public testing(string author,string searchKey){

 WebElement searchText = driver.findElement(By.name("q"));
        //Searching text in google text box

        System.out.println("Welcome ->"+author+" Your search key is->"+searchKey);

How will you display a value of a particular cell in a web table?

How will you handle dynamic elements using XPath?

Using below two methods,we can handle dynamic elements using XPATH in Selenium Webdriver

1.Absolute path

Creating xpath for web element from root of the element to destination element as below


2.Using contains and start-with()


What is POM?

A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects.




Thursday, 29 March 2018

Selenium Automation Testing Opening Bangalore

04:53:00 0
Selenium Automation Testing Opening Bangalore
Greetings from US Tech Solutions,We have an immediate job opening for Automationif you are interested for below JD please revert me with following details and your updated resume tomanjula@ustechsoultionsinc.com, References are more helpful.

Role: Automation
Client: MNC Company
Job Location: Bangalore
Exp: 4+ Yrs

Key skills required for the job are:

·         Test automation with using Ruby and Cucumber (Must).
·         Automation Framework – Selenium (Must), IntellijIdea (Ruby).
·         SoapUI, REST API, Splunk, MQ Explorer(Good to have)
·         SQL (DB2) and Mongo DB, exposure to agile practices.

Please revert me with following details:

Total Exp: Yrs,
Relevant Exp: Yrs,
CCTC: Lpa,
Take Home per month:
ECTC: Lpa,
Notice Period: Days,
Current/Last Working Organization:
Pay rolling company Name:
Are you interested for Contract to Hire?
Current Location:
Preferred Location:
Full time Education:
Date of Birth:
Skype ID:
Alternative Mobile No:
Alternative Email:
Reason for looking change:

Thanks & Regards,
Manjula. Thota
Ph: 040-66309632

Software Testing Opening with Capgemini

03:20:00 0
Software Testing Opening with Capgemini
This is opening with Capgemini for software tester.
Position type: Permanent
Job location: Mumbai - Andheri (Powai)
Experience Range: 6  to 10 Years

 Role & Responsibilities:

1. Ability to work independently on assigned QA activities – doesn’t need to be directed at all times
2. Own complete QA responsibilities for application/ suite of applications
3. Maintain relationship with stakeholders including dev teams, BA teams & users
4. Work with dev teams by sharing system QA metrics and work towards system/ user value
5. Mentor junior members in the team
6. Pro-actively look for opportunities to improve business value derived from application

Mandatory Desired Technologies :

1. Minimum 2 years of hands-on experience with Selenium and or other functional automation test tools.
2. Solid scripting and programming skills (with emphasis on Java, VBScript, SQL)
3. Strong troubleshooting skills, Strong analytical and problem-solving
4. Hands-on expertise to design automation framework
5. Knowledge of different manual testing methodologies and test documentation procedures including   ETL testing.
6. Ability to execute manual test cases and document actual results within the tool.
7. Expertise in Manual Systems/Unit/Integration Testing
8. Knowledge of HP ALM.
9. Ability to formalize test results into a document that communicates findings
10. Well versed with QA processes and tools. Knowledge of Financial and Banking applications will      be    an added advantage
11. Any automation certifications, experience in performance testing

If interested Kindly share your updated CV on prachi.ukey@seedinfotech.com along with below details:

Total exp:
 Relevant experience with Selenium and or other functional automation test tools:
Current CTC:
Expected CTC:
Notice period:

 Prachi Ukey | JR. Officer-Staffing|
Intellectual Resource Center,
SEED Info tech Pvt ltd,Pune

Sunday, 25 March 2018

By Default time of WAITFOR command is

04:36:00 0
By Default time of WAITFOR command is
By Default time of WAITFOR command in Selenium Webdriver,While working with AJAX Applications,it is required to wait our Selenium Test Scripts until loading is completes,in order to verify whether expected test element is displaying or not at that time we can use Selenium waiting commands in Test Scripts.

By Default WAITFOR Command is

By Default time of WAITFOR Command

Options are as below

1. 15 seconds
2. 20 seconds
3 25 seconds
4.30 seconds

ANSWER : 30 Seconds

Trending Posts:

Which Testing is PERFORMED First

Please provide your valuable comments on this Posts,In case you feel answer is not proper,Please provide your answers in below Comment section.Thank you for Reading.

Which Testing is performed first

03:56:00 1
Which Testing is performed first
Which testing is Performed First,In software Testing process it is little bit confuse that how to start Testing on AUT and in STLC which Testing is performed first.Let's discuss the same with below questions.

Which Testing is Performed First

Which Testing is performed first

In Interview room difinitely you will face this type questions,so it is very easy to answer those type of questions.

Choose the Below Options:

1. Black box testing
2. White box testing
3. Dynamic testing
4. Static testing

Above Question ANSWER is Static Testing.

What is Static Testing?

Static Testing is a type of technique by which you can verify the error or defects in software without Test Cases execution.Static testing is performed to avoid defects an early stage of development and it is easy to find sources of failures.Static testing helps to find defects that may not be found in Dynamic Testing technique.

Types of static testing techniques

There are two types of static testing techniques,those are as follows

1.Manual Examinations: Manual examinations verifies analysis of code written manually, and it is also called as REVIEWS.
2.Automated analysis using tools: Automated analysis are basically static analysis which is performed using any automation tools.

Friday, 23 March 2018

How to Select a Dropdown in Selenium WebDriver using Java

10:37:00 0
How to Select a Dropdown in Selenium WebDriver using Java
In order to select a dropdown value using Selenium WebDriver we have to create a Select an element and will not use the default WebElements provided by Selenium Webdriver.

Let's consider below drop-down example to select a value using Selenium WebDriver.

1.HTML Dropdown Code:

<select id="citySelect">
<option value="option1">Ahmedabad</option>
<option value="option2">Hyderabad</option>
<option value="option3">Mumbai</option>
<option value="option4">Pune</option>

1.1 Identify the HTML Element to Select value

Selenium WebDriver providing WebElement class to  identify the or store web element as below

WebElement CitySelection = driver.findElement(By.id("citySelect"));
Select dropdown= new Select(CitySelection);

Another method is directly you can pass in WebElement as below

Select dropdown = new Select(driver.findElement(By.id("citySelect")));

1.2 Select an Option

You can select drodown options by three ways


2.1 selectByVisibleText:

You can select dropdown value by matching visible text as below


2.2 selectByIndex:

You can select the dropDown value by index attribute of an element as below


index =1 means Ahmedabad
index=2 means Hyderabad

2.3 selectByValue:

You can select dropDown value by Optioon Value in above HTML code we've used multiple options 1,2,3,4 and code will be


3.Complete Selenium Webdriver Code as follows:

WebElement CitySelection = driver.findElement(By.id("citySelect"));
Select dropdown= new Select(CitySelection);

Saturday, 3 March 2018

Selenium WebDriver Page Object Model Framework Introduction

18:09:00 0
Selenium WebDriver Page Object Model Framework Introduction
Page Object Model Framework in Selenium WebDriver has come to be very popular Selenium WebDriver test automation framework in the software industry and many IT companies are following this framework because of its easy to write test scripts, Test script maintenance and reduces the duplication of code.

The main merit of Page Object Model in Selenium WebDriver is that if the Web UI changes for any module pages, it don’t require to change any Selenium WebDriver Test Scripts, we just need to change only the Test Page code within the page objects. 

Page Object Model in Selenium WebDriver


public class LoginPage{

public static WebDriver driver;
private By pageTile = By.xpath("//input[@title='Selenium WebDriver']");
private By homePage=By.id("home");
private By singInPage=By.id("login");
private By uname=By.id("userName");
private By password = By.id("password");


In the above code, we've identified the Element locators and defined in the after the class. In this way we can achieve readability of test scripts and we can easily identify Web Element locators and change the Element Locators as per required only in page object classes.
Page Object model in Selenium WebDriver is useful in preparing the AUT functionalities or Reusable components of a Webpage which we want to automate in a separate Test class. Let’s consider as Login Page.

As per Selenium WebDriver ORG Page Object Model is

"Within your web app’s UI there are areas that your tests interact with. A Page Object simply models these as objects 
within the test code.This reduces the amount of duplicated code and means that if the UI changes, 
the fix need only be applied in one place."

For the above page I’m creating simile class as LoginPage.class. In this class we’ll write reusable methods to call in another class to implement the Test cases.

Let’s consider entry page as Bing Search Page which will have many options like Search, Sign In, Images, Videos, Maps, News Languages, MSN, Outlook.com links. Here as per user action it will navigates to respective web pages to achieve this all functionalities that we want to automate should have reusable methods/components for each web-page.

Now as our main Entry Page is Bing Home page user can navigate to respective pages by clicking on any link from the Bing Search page. Whenever users are navigating to respective pages, we have to return particular page objects. Otherwise Return the current page object as this action doesn't navigate to another page signified by another Page Object.

The Page Object model advantages.

1. Clean Code between test code and page specific code such as locators and layout.
2. Single Object Repository for all functionalities, No Duplication of codes.

In above situation this allows you to perform modifications only in UI because of CR in current requirements or changes in UI Designs.

As per Selenium WebDriver WIKI Page

There is a PageFactory in the support package that provides support for this pattern, and helps to remove some boiler-plate code from your Page Objects at the same time.

Friday, 2 March 2018

Page Object Model in Selenium WebDriver Step by Step Guide

11:33:00 0
Page Object Model in Selenium WebDriver Step by Step Guide
Page Object Model in Selenium WebDriver Projects has become crucial Automation Framework in different organization and many software Testers are implementing Selenium Page Object Model in their project why because it is easy to maintain Test Scripts, easy to understand the Test Execution, easy to maintain Page Object Repository and last but not least reduces the duplication of code.

Recommended Articles

Write Test Cases PASS OR FAIL in Excel with SELENIUM
Create Object Repository in Selenium Project.
Page Factory Framework Implementation Examples.
Start APPIUM server programmatically.

Page Object Model in Selenium WebDriver

The main advantage of Page Object Model in Selenium WebDriver is easy to maintain Page Objects, easy to avoid duplicate of Code. Duplicate code in Selenium cause duplicate of different Functionalities with this duplicate code which results in multiple time repetition of duplicate element locators. You will learn How to implement Page Object Model in Selenium using Simple Examples as explained below. In this examples I’m using simple Login.java class, so that you can implement for other classes in your Selenium Projects.

In this Page Object Model, you need to create two packages

One for Page Objects Second one for Page Test Cases Implementation as below example.


STEP 1: First Create JAVA Project
STEP 2: Configure required JAR files in Build Path
STEP 3: Create two packages under src folder
STEP 4: One Package for Page Object (Object Repository)
STEP 5: Second Package for Page Test Classes.


Above class created under page Objects package and code will be as follows

package com.selenium.pageObjects; 
import org.openqa.selenium.*; 
import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.WebElement;
public class LoginPage {
        private static WebElement element;
    public WebElement setUserName(WebDriver driver){
         element = driver.findElement(By.id("uName"));
         return element;
     public WebElement setPassword(WebDriver driver){
         element = driver.findElement(By.id("password"));
         return element;
     public WebElement clickOnSignin(WebDriver driver){
         element = driver.findElement(By.id("submit"));
         return element;

WebDriver is being passed as a Method Arguments for each methods, so that Selenium is able to locate the Web Page elements on the specified browser using driver object.

In above code element is returned, because method is not a void that is the reason we should return the values inside the method to use in another class or somewhere.so that an Action can be performed on elements.

Method is declared as Public WebElement, so that method can be used in any other methods without instantiate the class.Now let’s create Page Test Case class under page Actions package as below for Login Page.


package com.selenium.Actions;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import com.selenium.pageObjects.LoginPage ;

public class LoginTest {

     private static WebDriver driver = null;
 LoginPage login=new LoginPage();

//Main Method
   public static void main(String[] args) {

     driver = new FirefoxDriver();
     driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

     // Use page Object library now


     System.out.println(" User Login Successfully,My Account screen is open");




Now create testng.xml file to run your Test Actions classes as specified in your testng.xml file,Just right click on it and Run As – TestNG Tests. 

 You will see Test script Execution on Firefox Browser as provided login credentials. 

 Thank you for reading my blog ,Please share this post in case you feel informative and provide your valuable comments on this post.

Thursday, 1 March 2018

Selenium Webdriver Using Python - Complete Tutorial Guide

23:25:00 0
Selenium Webdriver Using Python - Complete Tutorial Guide
Selenium supports Python language bindings and can be developed with Selenium Test Scripts for testing.

Python is easy matched to other programming languages, having extreme fewer verbose.
Python language is easy to learn and easy to write the scripts using Python Language.

The Python Language APIs enables you to link with the browser from end to end using Selenium.Selenium guides the standard Python commands to different browsers.

Selenium WebDriver Test Scripts can be run in different browsers and on different operating Systems such as


What is Python?

Python is a high-level object oriented programming language or scripting Language with dynamic semantics. 

Selenium Webdriver Using Python - Complete Tutorial Guide
Selenium Webdriver Using Python - Complete Tutorial Guide

Selenium WebDriver Using Python - Complete Tutorial Guide

1.Python is a Simple Language
2.Easy to Learn
3.Easy to Read
4.Easy to Maintain

Sample Python Example:

print("Hello World!")
ready = True
if ready:
print("Hello World!")

Why to Choose Python Language in Selenium WebDriver

Below different points explains why Python language is better for Selenium WebDriver scripting, those are

1.Extensive Support Libraries
2.Open Source
3.Learning Ease and better Support
4.User Friendly Data Structure
5.Python uses indentation

Selenium WebDriver Python bindings provides a better API to write functional/acceptance test scripts using Selenium WebDriver. Through Selenium WebDriver Python API we can access all functionalities of Selenium WebDriver in a natural way.

Selenium WebDriver Python Concepts:

Download Python Bindings for Selenium WebDriver
Install Python Language.
Download Drivers for Browsers
First Selenium Python Script
Selenium Web Pages Interaction using Python
Locating Elements
Python Wait Commands
Selenium Page Objects
Selenium WebDriver API