Selenium IDE Xpath Tutorials

Selenium Xpath Tutorials

Identifying xpath for element with examples to use in selenium

QA Engineers need to provide any element locator(like id, name, css path, xpath etc.) in target column of selenium window to locate that specific element to perform some action on it .If you have worked with selenium IDE then you knows that sometimes elements does not contains id or name. Locating element by xpath is the another way of locating element and you can use it as a alternative of id or name of element.


What Is Unique About Selenium Master

Selenium Master LLC offers training, consulting, job placement and employment assistance in these IT fields below. If you are an employer, send your job requirements to This email address is being protected from spambots. You need JavaScript enabled to view it. ; if you are looking for a job, send your resume to This email address is being protected from spambots. You need JavaScript enabled to view it. , we will find you a right position. 


  • Software Engineer
  • Software Engineer In Test
  • Manual Quality Assurance Engineer
  • Business Analyst
  • Quality Assurance Automation Engineer
  • Database Admin
  • Data scientist

To support larger IT projects in Software development and Test Automation and minimize the site maintenance, all the contents are open to the public for free

 Selenium is an open source functional test automation tool,  and it is one of the most well-known testing frameworks in the world.Selenium allows testers and developers alike to develop functional tests to drive the browser. It can be used to record workflows so that developers can prevent future regressions of code. Selenium can work on any browser that supports JavaScript since Selenium has been built using JavaScript.

Selenium Master is your one stop shop for mastering various Selenium techniques to automate your web based application testing. You may have seen other sites that provide information about using Selenium. Those sites often use testing public websites like Google or Yahoo as examples.

However, in your testing, you mostly test internal applications that drive the business in your company or organization.Selenium master will provide guidelines for using Selenium test framework and various unit test level applications on this site and teach you how to use Selenium for testing. Most of the sample codes on this site will use Mahara ePortfolio system as a test application. You will learn the following technologies.  


  • Selenium IDE
  • Selenium Robot Framework
  • Selenium RC
  • Selenium Mobile Test with Selendroid
  • Selenium Grid
  • Selenium Appium Mobile Test Framework
  • Selenium Web Driver with Java
  • Selenium Performance Test with TestNG
  • Selenium Web Driver with .Net
  • Selenium Performance Test with JMeter
  • Selenium Web Driver with Python
  • Test Cases and Management
  • Selenium Web Driver with Ruby
  • Software Development Life Cycle (SDLC)
  • SQL Database and Data Management
  • Job Interview Questions

Write Selenium WebDriver TestNG Result to Excel File

In this example you will learn how to use Selenium WebDriver with TestNG and write test result into an Excel file with Apache POI library. The key feature of the sample is that you use Selenium Java WebDriver that will launch a browser and run each test sequentially. Each test has description in the test methods. After test is done, you can see test result both in TestNG output html file and an Excel file as shown below.

Test Step Id Action Expected Result Actual Result
1 navigate to site and login site opens and login success Pass
2 navigate to User Settings Page Page Displayed Pass
3 User can change settings Settings changed Pass
4 User can logout Logout successfull Pass

Model your test cases

Before you start automation, you need to know what are the tests and what you are going to validate. Let's break the test suite into 4 test cases.

Test 1 (launchSiteAndLogin)
1. Go to http://www.seleniummaster.com/seleniummastertestapp/index.php
2. Enter "test" in the Username field
3. Enter "XXXX" in the Password filed
4. Click on the Login button
5. Verify that the text "Selenium Test" is present.

Test 2 (openUserSettingPage)
1. Click on the Settings link on the top of the page
2. Enter "test" in the Username field
3. Enter "XXXX" in the Password filed
4. Click on the Login button
5. Verify that Account Prefernces page displayed.


Python REST API Response With UI Verification

In Selenium Python web test automation, we may need to verify REST API response against UI displayed content. In other words, what the REST API returned should be the same as what the UI displayed on the webpage. In this example, I use the open weather data api for testing. We load the api url on the webpage and get the api response for the same url and compare the response with the UI content. Here is the URL;


When we open the above URL with the Chrome browser, we get the following content on the UI. 

{"coord":{"lon":-76.61,"lat":39.29},"weather":[{"id":800,"main":"Clear","description":"clear sky","icon":"01d"}],"base":"cmc stations","main":{"temp":279.219,"pressure":1025.61,"humidity":65,"temp_min":279.219,"temp_max":279.219,"sea_level":1032.41,"grnd_level":1025.61},"wind":{"speed":4.17,"deg":255.501},"clouds":{"all":0},"dt":1456610617,"sys":{"message":0.0102,"country":"US","sunrise":1456573287,"sunset":1456613832},"id":4347778,"name":"Baltimore","cod":200

In our test, we verify that (1) in the UI content, the city name should be "Baltimore"; (2) API response should be the same as UI displayed text;


Using Selendroid For Mobile Web Test Automation

Selendroid is a test automation framework which drives off the UI of Android native and hybrid applications (apps) and the mobile web. Tests are written using the Selenium 2 client AP. In this example, you will learn how to use Selendroid for testing a mobile web application. Test site for this example is the Mahara ePortfolio demo site "http://demo.mahara.org".

Test case:

Admin user should be able to log on to the system.

Test Implementation

Step 1: Download the Selendroid Standalone Java libraries from this site "http://selendroid.io/". If latest build is available on this location, download the latest snapshot from here "http://ci.selendroid.io/job/selendroid/io.selendroid%24selendroid-standalone/".

Step 2: Install Android SDK from the android development site "http://developer.android.com/sdk/index.html" . And setup the android development environment according to the instruction on this site "http://spring.io/guides/gs/android/".


Use Selenium Appium Automation For Mobile Apps

In this example, I will explain how to use Selenium Appium Automation for mobile app testing. 

Appium is an open source test automation framework for use with native and hybrid mobile apps. It drives iOS and Android apps using the WebDriver JSON wire protocol. 

Step 1: download the Appium Framework and sample example files provided by the site http://appium.io .  Click on the corresponding links to download the framework and sample files. 


Use Selendroid to Test Mobile Web Application on Mobile Device

To assure the quality of mobile web application, we need to test mobile web application on real mobile devices instead of testing it on mobile emulator. This example teaches you how to test mobile web application on android mobile device. 

In this article, we use Ebay mobile site as a test application.  To identify web elements, please read the article titled "How to Identify Mobile Web Application Elements for Selendroid" . 

Test Case

Verify that users are able to search merchandise on Ebay mobile web site.

Test Step

Step 1: navigate to http://m.ebay.com

Step 2: type in android in the search box

Step 3: click on search button or press enter.

Step 4: assert that the website returns number of android merchandises.

Automation Test Implementation

Step 1: create a Java project named "SeleniumMasterMobileTest", add a package named "com.seleniummaster.mobiletest", and add a JUnit test class named "MobileWebTesteBayMobile.java". Make sure that in the build path, you referenced all required libraries as well as the Selendroid web driver library "selendroid-standalone-0.9.0-SNAPSHOT-with-dependencies.jar".