About - Selenium

Definition

Development and Versions

Pre-requisites

Languages supported

Manual vs Automation

Choosing Selenium

Selenium - Components

Selenium IDE

Selenium RC

Selenium WebDriver

Selenium Grid

QTP

Selenium vs QTP

Selenium - IDE

Features

Install and configure

Selenium - Webdriver

About WebDriver

install and configure

First test case

Web element

Element Locators

Example of locators

Chropath

Web driver commands

Eclipse and TestNG

About Eclipse

Choose and download

About TestNG

Testng installation on eclipse

Testng Annotations

Pass Fail and Skip test cases

Run test cases in batch

testng.xml - Explanation

testng grouping

Running tests parallely

dependsOnMethods

dependsOnGroups

Prioritization

Passing parameters

Data providers

Read data from excel

Ant - XSLT reports

Testng listeners

Cross browser testing

Page Object Model



Selenium - Cross browser testing
 
The following code is used to test with FIrefox Driver:

package com.ananda.selenium.demo;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class SelenniumDemo1 {

public static void main(String[] args) throws InterruptedException {

System.setProperty("webdriver.gecko.driver", "C://Program Files/Mozilla Firefox/firefox.exe");

//System.setProperty("webdriver.chrome.driver", "C://Program Files/Google/Chrome/Application/chrome.exe");

//System.setProperty("webdriver.ie.driver", "C://Program Files/InternetExplorer/internetEx.exe");

WebDriver driver= new FirefoxDriver();
driver.get("http://google.com");
Thread.sleep(2000);
driver.close();

}
}


The following code is used to test with Chrome Driver:

package com.ananda.selenium.demo;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class SelenniumDemo1 {

public static void main(String[] args) throws InterruptedException {

System.setProperty("webdriver.chrome.driver", "C://Program Files/Google/Chrome/Application/chrome.exe");

WebDriver driver= new ChromeDriver();
driver.get("http://google.com");
Thread.sleep(2000);
driver.close();

}
}
The following code is used to test with InternetExplorer Driver:

package com.ananda.selenium.demo;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;

public class SelenniumDemo1 {

public static void main(String[] args) throws InterruptedException {

System.setProperty("webdriver.ie.driver", "C://Program Files/InternetExplorer/internetExplorer.exe");

WebDriver driver= new InternetExplorerDriver();
driver.get("http://google.com");
Thread.sleep(2000);
driver.close();

}
}

if we want to test for all the browsers simultaneously, we can achive as follows:
public class CrossDrowserDemo {
public static WebDriver driver;

public static void main(String[] args) {
for (int i=1; i <= 3; i++){
if (i == 1) {
driver = new FirefoxDriver();
System.setProperty("webdriver.gecko.driver", "C://Program Files/Mozilla Firefox/firefox.exe");
}
else if (i == 2) {
System.setProperty("webdriver.chrome.driver", "C://Program Files/Google/Chrome/Application/chrome.exe");
driver = new ChromeDriver();
}
else if (i == 3){

System.setProperty("webdriver.ie.driver", "C://Program Files/InternetExplorer/internetExplorer.exe");
driver = new InternetExplorerDriver();
}
driver.get("https://www.google.com");
Thread.sleep(2000);
driver.close();
}
}
}

I conduct online tutions on Manual Testing, Selenium and the following. For more details contact anandaibmindia@gmail.com
Manual Testing - 1600/-           Selenium - 1600/-
           Jsp and Servlet -2000/-           Java training - 2000/-