i
WebDriver Introduction
Selenium WebDriver Architecture
Introduction to WebDriver API
Introduction to WebDriver – Code
Handling Dropdowns and Select class
Handling Multiple Dropdown values and Links
Handling Radio buttons and Checkboxes
Capture Screenshots and Email test results
Browser Navigation Methods
Handling tabs
Capturing screenshot, Handling tabs and pop-ups – Code
Handling tabs and Pop-ups – Code
Handling Alerts
Handling User Authentication and Input alerts
HtmlUnitDriver and Handling Captchas
Handling Web Tables
Synchronization
Handling WebTables, Synchronization issues, Firefoxprofiles – Code
Actions Class
Event Listeners, Event Firing Mouse, Coordinates – Code
Handling Mouse Hover in Selenium
JavascriptExecutor
Handling Iframes
IsElementPresent, IsEnabled, IsSelected
Working with Chrome Driver - Part 1
Working with FireFox Driver - Part 2
Working with Internet Explorer Driver - Part 3
Handling SSL Certificate
Desired Capabilities
How to Encode password in WebDriver
Handling JQuery Elements - Drag and Drop, Sliders, Resizable
Handling JQuery Elements - Drag and Drop, Sliders, Resizable – Code
Working on IE Browser using Actions
TestNG, Ant & Report Generation through XSLT
Introduction to TestNG and Annotations
TestNG Parameterization
Configuring ANT, Generating TestNG & XSLT Reports
Code for generating XSLT / Surefire Reports through MAVEN
TestNG Parameterization Excel Reading
Handling Multiple data providers
TestNG XSLT Jar, Build.xml & TestNG.xml file
Frameworks Introduction
Hybrid (DATA + KEYWORD) driven Framework
Framework Architecture
Reading Excel sheets
TestNG DataProvider
Data Provider with Hashtable
Handling Multiple Test Suites
Multiple DataProviders
Setting up Run-modes at Suite Level
Setting up Runmodes at TestCase Level
Creating a common utility for Run-modes
Hybrid Framework Code
What is the Desired Capability?
Desired capability is the capability of the automation tester to control the behavior of the web browser at the run time. We can set the browser behavior such as maximize browser window, Handling SSL certification error, Version of the browser, Name of the browser, and many more things that can be done by using DesiredCapabilities class.
DesiredCapabilities class has a range of methods available to set or get the behavioral attributes of a web browser. Let us see all those available methods:
One the most used method of the DesiredCapabilities class is setCapability() method. As this method helps user to set the behavior of the Web Browser at the run time. We will see the use of setCapability() method for Chrome, Firefox and IE browsers.
Chrome Browser:
There are a variety of capabilities there to set up using the setCapability() method of DesiredCapabilities. Let us see how to handle the SSL certification error issue in the Chrome browser by setting up the Desired capability.
package SeleniumTest.SeleniumTest;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class SSLCertificationErrorHandling
{
public static void main( String[] args )
{
DesiredCapabilities cap=DesiredCapabilities.chrome();
cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);// This accepts all the certs without seeing a security risk.
WebDriver driver=new ChromeDriver(cap);
driver.get(webUrl);
}
}
IE web browser:
We can handle SSL certification error and Protected mode setting barrier in IE browser by using DesiredCapabilities class as shown in the below sample code:
package SeleniumTest.SeleniumTest;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class SSLCertificationErrorHandling
{
public static void main( String[] args )
{
DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability("ignoreProtectedModeSettings", true);
cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
WebDriver driver=new InternetExplorerDriver(cap);
driver.get(webUrl);
}
}
Firefox browser:
Let us see how we control the behavior of Firefox behavior by using the DesiredCapabilities class, and we will handle the SSL error and setting up the screen resolution of the browser window.
package SeleniumTest.SeleniumTest;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class SSLFirefox
{
public static void main( String[] args )
{
String driverPath="C:\\Users\\AC42610\\geckodriver.exe";
System.setProperty("webdriver.gecko.driver",driverPath);
FirefoxOptions options=new FirefoxOptions();
options.setCapability("acceptInsecureCerts", true);
DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability(FirefoxOptions.FIREFOX_OPTIONS, options);
cap.setCapability("screenResolution", "1280x1024");
WebDriver driver=new FirefoxDriver(cap);
driver.get("https://hyperion-ui-test1.kubeodc-test.corp.intranet/#/home");
}
}
Don't miss out!