Cross Browser Testing amongst Selenium


Cross Browser Testing alongside Selenium

1) What is Cross Browser Testing?

Cross Browser Testing is a type of Test to cheque that our Web Application industrial plant equally expected inward dissimilar Browsers.

2) Why Cross Browser Testing?
A spider web application tin hand the axe last opened inward whatever spider web browser past times the destination user, So nosotros ask to ensure that the spider web application volition piece of occupation equally expected inward all pop browsers.

3) Popular Web Browsers
a) Google Chrome: It was released inward 2008, its marketplace position part to a greater extent than or less 68%

b) Mozilla Firefox: It was released inward 2004, its marketplace position part to a greater extent than or less 19%

c) Internet Explorer: It was released inward 1995, its marketplace position part to a greater extent than or less 6.5%

4) Working alongside dissimilar Browsers

> Selenium WebDriver supports Browser compatibility tests on around every pop browser, including Chrome, Firefox, IE, Opera together with Safari.

> The WebDriver API drives the spider web browser equally the existent user would crusade it.

> By default, Firefox driver comes alongside selenium-serverstanalone.jar library added.

> For Chrome, IE, Safari, Opera, at that topographic point are libraries that ask to last instantiated externally.

5) How to acquit Cross Browser Testing using Selenium WebDriver?

a) Element Locators - Same for all Browsers.

b) WebDriver Methods/Commands -Same for all Browsers.

c) Programming features (Java/C#/Python/Perl/Ruby/PHP) - Same for all Browsers.

d) JUnit / TestNG Annotations - Same for all Browsers.

e) Browser Driver - diverse from ane browser to another.

Note: For Mozilla Firefox, but exercise the driver, For other browsers, libraries that ask to last instantiated externally.
------------------------
f) Inspect Elements -

For Mozilla Firefox -Built inward characteristic Page Inspector,
(Install Firebug together with Firepath)

For Chrome together with IE - Built inward Developer tools

6) Create Browser Drivers
 

(For Google Chrome, IE together with Other Browsers, download Browser drivers together with laid upward

path inward Selenium Test Scripts)

a) Mozilla Firefox Browser:

WebDriver driverName = novel FirefoxDriver();

b) Google Chrome

//Instantiate Chrome Browser driver

System.setproperty("webdriver.chrome.driver", "driver .exe file path");
WebDriver driverName = novel ChromeDriver();

c) IE Browser driver

System.setproperty("webdriver.ie.driver", "driver .exe file path");
WebDriver driverName = novel InternetExplorerDriver();

7) Create a Test Case together with Execute using Mozilla Firefox, Chrome together with IE Browsers.

Test Case: Verify Launch Application (Google) functionality inward Firefox, Chrome together with IE Browsers.

Test Steps:
 

i) Launch the Browser
ii) Navigate to https://www.google.com url

Verification point:
Capture the page Title (Actual) together with Compare alongside Expected.

Expected Page Title: Google
-------------------------------
a) Test Case for Mozilla Firefox Browser

WebDriver driver = novel FirefoxDriver();
driver.get("https://www.google.com");

String PageTitle = driver.getTitle();

if (PageTitle.equals("Google")){
System.out.println("Google Application Launched - Passed");
}
else {
System.out.println("Google Application Not Launched -Failed");   
}
driver.close();
------------------------------
b) Test Case for Google Chrome Browser
 

System.setProperty("webdriver.chrome.driver", "E:\\chromedriver.exe");
WebDriver driver = novel ChromeDriver();
driver.get("https://www.google.com");

String PageTitle = driver.getTitle();

if (PageTitle.equals("Google")){
System.out.println("Google Application Launched - Passed");
}
else {
System.out.println("Google Application Not Launched -Failed");   
}
driver.close();
------------------------------
c) Test Case for meshing Explorer Browser

System.setProperty("webdriver.ie.driver", "E:\\IEDriverServer.exe");
WebDriver driver = novel InternetExplorerDriver();
driver.get("https://www.google.com");

String PageTitle = driver.getTitle();

if (PageTitle.equals("Google")){
System.out.println("Google Application Launched - Passed");
}
else {
System.out.println("Google Application Not Launched -Failed");   
}
driver.close();
------------------------------
8) Create a Test Case together with Execute using Mozilla Firefox, Chrome together with IE Browsers Continuously.

public aeroplane TestCase1 {
public static WebDriver driver;
public static int browser;
public static String BrowserName;

public static void main(String[] args) {

for (browser = 1; browser <= 3; browser++){
if (browser == 1) {
driver = novel FirefoxDriver();
BrowserName = "Mozilla Firefox Browser: ";
}
else if (browser == 2) {
System.setProperty("webdriver.chrome.driver", "E:\\chromedriver.exe");
driver = novel ChromeDriver();
BrowserName = "Google Chrome Browser: ";
}
else if (browser == 3){
System.setProperty("webdriver.ie.driver", "E:\\IEDriverServer.exe");
driver = novel InternetExplorerDriver();
BrowserName = "Internet Explorer Browser: ";
}
driver.get("https://www.google.com");

String PageTitle = driver.getTitle();

if (PageTitle.equals("Google")){
System.out.println(BrowserName + " - Google Application Launched - Passed");
}
else {
System.out.println(BrowserName + " - Google Application Not Launched -

Failed");   
}
driver.close();
}
}
}
------------------------

Sumber http://www.gcreddy.com/
Post a Comment (0)
Previous Post Next Post