Selenium Webdriver

Selenium – Skipping/Ignoring tests in TestNG - Objective Quickly learning ways to skip or ignore a test case in TestNG. Ignoring a test One can ignore a test during execution by simply adding enabled=false in the test. Example: SkipException Another way is to use SkipException to skip the test. Below is the code example on how to use this exception  
Selenium – Headless with HtmlUnitDriver - Objective Run Selenium tests in headless mode (i.e. without opening browser) with inbuilt HtmlUnitDriver. This is very easy and just 2 line code. Test1.java Create a java class Test1.java and paste following code in it. And we are done 🙂 Notice that we have used true in HtmlUnitDriver, this is done to enable javascript support. Ignoring Warnings You’ll notice […]
Selenium with Cucumber and Gradle - Objective Using Selenium with Cucumber and Gradle instead of Maven. We are going to use: IntelliJ Ultimate Edition Cucumber Gradle Selenium Java TestNG Purpose is to move from maven to gradle to get more options and flexibility which is helpful in CI/CD integration. Creating Project Lets quickly create a Gradle project in IntelliJ. Open File […]
Selenium – Cucumber – Passing Parameters - Objective We are going to pass parameters from Cucumber feature file to its corresponding steps file. What we are going to use: IntelliJ as IDE Selenium (for testing) TestNG Cucumber for TestNG dependency Cucumber Java dependency Simple parameter passing FirstTest.feature Lets create a feature file for Cucumber steps. Make sure that Cucumber and Gherkin plugin […]
Cucumber Setup – TestNG – Selenium - Objective Now a days lot of companies are asking for knowledge of BDD and exposure or experience in Behat/Cucumber. Don’t be too worried about Cucumber. Cucumber is nothing but Steps written in Gherkin language to which we have to map corresponding code. What we will be using: IntelliJ IDE – My favorite Cucumber plugin Gherkin […]
“Wait” in Page Object Factory – Selenium - Objective A quick demo on how to wait for an element in Page Object Factory. As we know, there are two ways of using page object pattern, one is using “By” and another one is using page object factory (i.e. “FindBy”). In the PageObjectModel using “By” we can use the explicit and implicit wait for […]
Mouse Over/Hover Action – Selenium - Objective Our objective in this small project is to do a mouse over on a particular link. We are not suppose to actually click it, only to hover our move on it. We are going to use Actions available in Selenium and chain them together since there is no separate “move hover/ mouse over” action […]
Facebook Post – Selenium Webdriver with Maven and TestNG - Quickly going to setup Selenium Webdriver to create Facebook post. We are going to use Selenium + Maven + TestNG Maven Configuration BaseSetup.java Setup test base. Copy paste following code into BaseSetup.java class We have used ops.addArguments(“–disable-notifications”) to disable the facebook notification which asks user to enable Chrome Notifications for facebook. FacebookPostTest.java The actual class […]
Data Driven Framework in Selenium – Apache POI – Excel Sheet - In this example we are quickly going to setup a Data Driven Framework for Selenium. The data source is going to be an Excel Sheet. We are going to you Apache POI since it supports “xlsx” format. For other benefits of it over JExcel, please click here. Our project structure will be somewhat like this […]
Allure Reports in Selenium - This example covers the implementation of Allure Reports in Selenium using TestNG, Java and Maven. Maven Configuration Repository Add following code to configure the jcenter repository Dependency Add following dependencies to your pom.xml Surefire Plugin Configuration Sample test for Allure Report Create a sample test with name test.java In the above class we have used […]