Home > Selenium

Different approaches for writing effective Xpaths for Web Automation

Are you new to web automation and struggling with crafting Xpaths for various scenarios? Look no further – this guide covers all possible ways to write Xpaths to suit every situation. Whether the web element's text is dynamic, attributes are unique, or you're dealing with complex structures, we've got you

This Article is TAGGED in , , , , , , , , . Read more

Protractor: Script execution using custom command

This article will cover below points:  Use of custom command instead of protractor along with user defined options to control the execution of script. Protractor script execution for different test suites using different configuration files i.e. In regression test suite we will execute all spec files In smoke test suite we execute

This Article is TAGGED in , , , , , , . Read more

Sample script in robot framework

Create new file in project with .robot extension.  Robot file contains below sections:  Setting  Variables  Keywords  Test Cases  In setting section all imports can be defined. In variables section, Test data should be defined. In Keywords section, All operations can be defined by calling predefined keywords. In Test Cases section, All operations can be performed by calling user defined keywords.     Here is the

This Article is TAGGED in , , . Read more

Finding elements of table in selenium

Elements in table can be accessed using xpath. Here is the sample HTML code: [crayon-6736407cc0ba5623230704/] To locate first “td” in first “tr” in above HTML code. Below is the xpath:   //table//tr[1]/td[1] To locate second “td” in first “tr”. Below is the xpath. //table//tr[1]/td[2] To locate cells of Pune and Mumbai below is the xpath. //table//tr[1]/td To locate the

This Article is TAGGED in , . Read more

Types of locators and best practices to use locators in selenium

There are 8 locators in selenium. Those are... tagName id name className linkText partialLinkText cssSelector xpath It is confusing to decide which locator to select while identifying the element. To avoid the confusion below are the best practices while selecting the locators. First preference should be given to tagName. If tagName is not unique or not available then next preference should

This Article is TAGGED in , , . Read more

Parallel execution of script in multiple browsers using selenium

Single script can be ran in multiple browsers. To perform that we need to define browser configurations in testng.xml file. [crayon-6736407cc0ceb038969645/] In class name we can mention script name. We can mention same script name or multiple script names. If you want to run in 3 different browsers then just copy test

This Article is TAGGED in , . Read more

File Upload Using Windows Automation Tool And Selenium

Here are the step to upload file using selenium Click on Select file / Select button (This part could be handled using Selenium) Select file from open dialogue box(This part could not be handled using selenium) Click on Upload or Upload file button. File Upload for INPUT tag with TYPE ="file" Example Url: If

This Article is TAGGED in , , . Read more

How to use @Parameters and @Optional annotations in the TestNG

TestNG @Parameters One of the important features of TestNG is parameterization. This annotation allows the user to pass parameter values to test methods through the testng.xml file. @Parameters({"param-name"}) Let's write a simple example of passing parameters to test methods through the XML configuration file. Steps to Perform: Open chrome and enter the Demo

This Article is TAGGED in , , , . Read more

TestNG: Use of Before and After annotations with sample code

Exmaples for @BeforeMethod and @AfterMethod in TestNG. @BeforeMethod allows the method to execute before the execution of each Test methods, whereas @afterMethod is executed after the execution of each Test methods.  [crayon-6736407cc0e70859944710/] Output: First Method:Before Method starts!Test with Default priorityAfter Method starts In the above output, we can observe for every Test first @BeforeMethod is

This Article is TAGGED in , , , , , . Read more

How to use Annotations in TestNG Framework

Annotations in TestNG Annotation is a feature introduced in Java 5 and is used to add a piece of code to the java source code.  Annotations are easy to use, maintain and understand. Annotations provide many useful attributes to use in the code. It is easier to find where the error

This Article is TAGGED in , , , , . Read more