Handle ArithmeticException using Try Catch in Java

Without TryCatch:

Output:

With TryCatch:

Output:

 

Right Click Action using Selenium WebDriver

Code:

Result:

 

 

Handle Javascript Alert using Selenium WebDriver

Code:

Result:

 

Headless Browser using HtmlUnitDriver in Selenium WebDriver

Code:

Result:

 

Headless Browser using PhantomJSDriver in Selenium WebDriver

Code:

Result:

 

 

 

Using Group in Selenium WebDriver

Test Case: 1

Test Case: 2

Case1: testng.xml

Case1: Result

Case2: testng.xml

Case2: Result

 

 

How to Ignore a test case using Selenium Webdriver

Test Case: 1

Test Case: 2

testng.xml

Result:

 

 

Parameterization using DataProviders

Code:

Output:

 

Using SoftAssertion in TestNG

Code:

Output:

 

Run failed test cases using Selenium Webdriver

Test Case: 1

Test Case: 2

FailedTestCases

ListenerClass

testng.xml

Output:

 

1 2 3 11