WebDriver Introduction:-(2.0/3.0)versions 
WebDriver is enhanced version of RC
It does not require Selenium standalone server interface
Provides improved consistency compared with  Selenium Remote control 
Introduction to Selenium WebDriveri) Introduction to Selenium WebDriverii) WebDriver Environment Setupiii) Create first Selenium Test CaseIntroduction to Selenium WebDriverSelenium Tool’s Suite        Selenium IDE        Selenium RC        Selenium WebDriver        Selenium Grid&gt; In 2006 Selenium WebDriver was launched at Google.&gt; In 2008, the whole Selenium team decided to merge Selenium WebDriver with Selenium RC in order to form more powerful tool called Selenium 2.0Selenium 1.0 + WebDriver = Selenium 2.0Selenium 1.0(Selenium IDE + Selenium RC + Selenium Grid)Selenium 2.0(Selenium IDE + Selenium RC + Selenium WebDriver + Selenium Grid)
Latest version of webdriver is  3.14Note: Now Selenium RC is only for  maintenance projects.----------------------&gt; It is a most important tool in Selenium Suite.&gt; It has Programming interface only, no IDE.&gt; Selenium WebDriver supports various programming languages to write programs (Test scripts)JavaPythonC#RubyPerlPHP&gt; Selenium WebDriver supports various Browsers to create and execute Test cases.Mozilla FirefoxGoogle ChromeIESafariOpera etc...&gt; Selenium WebDriver supports various Operating environments.MS WindowsLinuxMacintosh etc...&gt; Selenium WebDriver supports Data driven Testing and Cross browser testing.&gt; Selenium WebDriver is faster than other tools of Selenium suite.&gt; Selenium WebDriver supports Parallel test execution with the help of either JUnit or TestNG.-------------------------------Drawbacks of selenium Webdriver&gt; Selenium WebDriver doesn't have IDE (some difficult to create test cases)&gt; No Built-in Result reporting facility.&gt; No other tool Integration for Test management.&gt; No centralized maintenance of Elements/objects.--------------------------------------------------How we create Test Cases /Test Scripts / Tests in Selenium WebDriver:In UFT:Using Objects information and Test Methods we create Tests.In Selenium WebDriver:Using Element Locators and Webdriver Commands/methods we create Test Cases.Selenium IDE:Using Element locators and Selenese / Selenium IDE commands we create Test cases-----------------------------------Element Locators - to recognize elements/identify elements.WebDriver commands/methods - to perform operations on elements.--------------------------------------Java Programming - for enhancing Test CasesTestNG Framework - for grouping Test cases, batch Testing and generating Test Reports.-----------------------------------------------------------ii) Selenium installation pre requisitesSteps:1) Jdk(JDK1.6/1.7/1.8) software -to create programs (Test scripts) we can prefer 1.7 version2) Eclipse Edit . Eclipse have different flavours Luna/Neon other than this indigo
4)If ur using 1.7 use Luna or 1.8 Neon only 1.8of JDK
        Jdk1.6/1.7/.18
       Eclipse luna/neon
ii) Selenium jar files are required to work with webdriver
1)We have to download jar file called selenium java 2.53(1.7 or 1.8 with luna)/3.4[1.8 java &amp; neon eclipse editor]
Selenium –server –stanalone.jar onle new version
6.we have to use other component selenium server-standalone.jar this are jar files &amp; we are also using this for RC
 7) whenever we want to go with 2.53 version we need browser driver jar
    Chrome driver jar 
    IE driver jar file 
    Firefox jar file
---------------------------------------8 Req addons
       Install Firebug and Firepath plug ins (Mozilla Firefox) for inspecting elements.   we need two add ons 
Fire bug(id,name,css,link)
Fire path (x-path)
Will help us to know the locators strategy of web element
Fire bug:-using fire bug I can develop my app based on [Id,name,css,link]
Fire path:-using firepath I can develop my app based on [x-path]
Note:-if we select fire bug we can get automatically computable with what ever browser we are using
7) Browser Driver
    GeekoDriver(firefox)
    Chrome Driver(Chrome)
    IE Driver(internet explorer)
Note:geckodriver is a interface(mediator)for selenium &amp; firefox browser 2.53version we can directly go with firefox
version geckodriver doesn’t support directly firefox that’s y we are sending one data through geckodriver
most  of the companies are with gecko
Download Selenium Web Driver Java language binding from www.seleniumhq.org website and extract.
Download files :- 
www.selenium .org-&gt;selenium java 3.4.0_. downloadgeckodriverthan go to downloads selenium.java 3.4.0 extract to selenium java
next  geckodriverv.0.18.0 win 64.zip
extract gecko driver  
For configuration:-
Go to eclipse neon.3
Same for google chrome.32or 64bit
U can check in google(right click setting) 
Create Java Project:-
&gt;Java page
&gt;New
&gt;Javaproject-&gt; project name can be anything
&gt;Project name-&gt;selenium
&gt;Jre
&gt;Use an execution here select javase-1.8
&gt;Finish
&gt;Now click on button under file package explorer
&gt;Right click on selenium create package
&gt;Select webdriver selenium right click&gt; Build path&gt; Configure build path&gt; Select "Libraries" tab&gt; Click "Add external Jars" &gt; Browse path of the WebDriver jars select seleniumjava.3.4.0(1).&gt; Apply &amp; ok -------------------------------------Webdriver Methods:-
Get method:-is used to open a requested webpage
Eg: wd.get("http://www.adactin.com/HotelAppBuild2/");
Findelement:-using this method we can findout a web element from a page
By method:-Using this method we can provide the value of one of the locator &amp; web element to find element method
Send keys method:- Using this method we can pass input values to a web element(Text box) 
        Eg: wd.findElement(By.xpath(".//*[@id='username']")).sendKeys("hemanth123");
        Note:-we are using find element method &amp; by method together without by we cant use findelement method
Click method: we can perform operations on a web element.
Wait or Time Methods: generally while we are migrating to one page another page we prefer wait methods.
Thread.sleep:- is used to make to wait the script for some time or
 is used to avoid the synchronization problem or 
to manage the deference time in the execution between script to  and Web page .
Implicit Method:
Explicits Method:
Clear method:-using this method we can clear the previous value if any from the web page 
For every element data can be cleared separately some time our browser will have some default value for that we use clearvalue.
Linear Frame Work Eg:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class AdactinLoginwithxpath {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();
wd.get("http://www.adactin.com/HotelAppBuild2/");
Thread.sleep(2000);
wd.findElement(By.xpath(".//*[@id='username']")).sendKeys("hemanth123");
        wd.findElement(By.xpath(".//*[@id='password']")).sendKeys("hemanth123");
        wd.findElement(By.xpath(".//*[@id='login']")).click();
        
}
getCurrentUrl: is used to get the current page url
eg:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class GetCurrentUrl {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();

wd.get("https://www.amazon.com/");
String x=wd.getCurrentUrl();
System.out.print(x);
}
}
getTittle: is used to get the Tittle of the current webpage.
Eg:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class GetTittle {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();
wd.get("http://www.adactin.com/HotelAppBuild2/");
String x=wd.getTitle();
System.out.println(x);
}
}
getPageSource: is used to get the current page source code:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Getpagesource {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();

wd.get("https://www.amazon.com/");
String x=wd.getPageSource();
System.out.println(x);

}
}
getText : is used to get the Text msg or static value from the webpage:
getAttributeValue: is used to get input value or Dynamic value of a webElement.
Eg:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Adactin_getAttribute_getText {
public static void main(String[] args) throws InterruptedException {


System.setProperty("webdriver.chrome.driver", "D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();
wd.get("http://www.adactin.com/HotelAppBuild2/");
Stringz=wd.findElement(By.xpath("html/body/table[2]/tbody/tr/td[1]/p[1]")).getText();
System.out.println(z);
Thread.sleep(2000);
wd.findElement(By.id("username" )).sendKeys("hemanth123");
String x=(wd.findElement(By.id("username" ))).getAttribute("value");
System.out.println("the user name is: "+x);
wd.findElement(By.id("password" )).sendKeys("hemanth123");
String y=(wd.findElement(By.id("password"))).getAttribute("value");
System.out.println("the password name is" +y);
wd.findElement(By.id("login" )).click();
wd.quit();
}
}
NAVIGATION METHODS:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class NavigateMethods {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();

wd.get("https://www.amazon.com/");
String x=wd.getCurrentUrl();
System.out.println(x);
//navagate is property to,back,forward,refresh are method
//navigate()to("url");is used to load a new page in the current web browser
wd.navigate().to("http://adactin.com/HotelAppBuild2/");
String y=wd.getCurrentUrl();
System.out.println(y);

//navigate().back(): is used to moves single item back  in the browser history
wd.navigate().back();
String z=wd.getCurrentUrl();
System.out.println(z);


//navigate().forward():is used to moves single item forward  in the browser history

wd.navigate().forward();
String a=wd.getCurrentUrl();
System.out.println(a);

//navigate().refresh: is used to refresh the current webpage
wd.navigate().refresh();

}
}
selectByvalue: is used to select a particular item from the given list
eg:
new Select(wd.findElement(By.id("location"))).selectByValue("Sydney");
selectByIndex: is used to select a particular item from the given list based on Index location.
Eg:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class SelectByVisible {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();

wd.get("https://www.amazon.com/");
new Select(wd.findElement(By.id("searchDropdownBox"))).selectByIndex(3);
}
}
SelectByVisibleText: is used to select  particular item from the given list .
Eg:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class SelectByVisible {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();

wd.get("https://www.amazon.com/");
new Select(wd.findElement(By.id("searchDropdownBox"))).selectByVisibleText("Books");
}
}
Clear: is used to clear the value
Close: is used to close the current page
Quit: is used to close all the browsers
Is Enabled: is used to check whether the element is enable state or not which returns Boolean results
IsDisplayed: is used to ceck wether the element is displayed or not 
Eg:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class AdactinLoginwithxpath {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();
wd.get("http://www.adactin.com/HotelAppBuild2/");
 boolean a=  wd.findElement(By.xpath(".//*[@id='login']")).isEnabled();
      System.out.println(a);
      
      boolean b=  wd.findElement(By.xpath(".//*[@id='login']")).isDisplayed();
      System.out.println(b);
     
Thread.sleep(2000);
wd.findElement(By.xpath(".//*[@id='username']")).sendKeys("hemanth123");

        wd.findElement(By.xpath(".//*[@id='password']")).sendKeys("hemanth123");
        wd.findElement(By.xpath(".//*[@id='login']")).click();
       
        
}
}
isSelected: is used to check the given
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Is_selected {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "D:\\WebdriverKit\\BrowserDrivers\\ChromeDrivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();
wd.get("http://scoremore.talentsprint.com/login?next=/dashboard");
boolean x=wd.findElement(By.id("remember-yes")).isSelected();
System.out.println(x);
}
}
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class IsSelected {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();
wd.get("http://scoremore.talentsprint.com/login?next=/dashboard");
boolean x=wd.findElement(By.id("remember-yes")).isSelected();
System.out.println(x);
}
}
Modular Frame Work: is used to execute Multiple scripts at a time.
Sub Class1
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Mdf_operationalMethod {
WebDriver wd;
public void LaunchBrowser() {
System.setProperty("webdriver.chrome.driver","D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");//to open browser
 wd=new ChromeDriver();
}
public void AcessApp() throws Throwable {

wd.get("http://adactin.com/HotelAppBuild2/");
Thread.sleep(2000);


}
public void UserLogin() throws Throwable {
wd.findElement(By.id("username")).sendKeys("hemanth123");
wd.findElement(By.id("password")).sendKeys("hemanth123");
wd.findElement(By.id("login")).click();
Thread.sleep(2000);

}

}
SubClass2
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.Select;
public class Md_Tktbooking extends Mdf_operationalMethod 
{
public void tktBooking() throws InterruptedException
{
 new Select(wd.findElement(By.id("location"))).selectByValue("Sydney");
 new Select(wd.findElement(By.id("hotels"))).selectByIndex(1);
 new Select(wd.findElement(By.xpath(".//*[@id='room_type']"))).selectByIndex(1);

 new Select(wd.findElement(By.xpath(".//*[@id='room_nos']"))).selectByIndex(2);
 wd.findElement(By.xpath(".//*[@id='datepick_in']")).sendKeys("03/07/2018");
 wd.findElement(By.xpath(".//*[@id='datepick_out']")).sendKeys("05/07/2018");
new Select(wd.findElement(By.xpath(".//*[@id='adult_room']"))).selectByIndex(1);
 
 new Select(wd.findElement(By.xpath(".//*[@id='child_room']"))).selectByIndex(2);
 wd.findElement(By.xpath(".//*[@id='Submit']")).click();
 Thread.sleep(1000);

 //Select hotel process
 wd.findElement(By.xpath(".//*[@id='radiobutton_0']")).click();
 wd.findElement(By.xpath(".//*[@id='continue']")).click();
 
 //Booking process
 wd.findElement(By.xpath(".//*[@id='first_name']")).sendKeys("anil");
 wd.findElement(By.xpath(".//*[@id='last_name']")).sendKeys("KUmar");
 wd.findElement(By.xpath(".//*[@id='address']")).sendKeys("Delhi");
 wd.findElement(By.xpath(".//*[@id='cc_num']")).sendKeys("1234567123451212");
 new Select(wd.findElement(By.xpath(".//*[@id='cc_type']"))).selectByIndex(2);

 
 new Select(wd.findElement(By.xpath(".//*[@id='cc_exp_month']"))).selectByIndex(1);
 new Select(wd.findElement(By.xpath(".//*[@id='cc_exp_year']"))).selectByIndex(11); 
 wd.findElement(By.xpath(".//*[@id='cc_cvv']")).sendKeys("159");
 wd.findElement(By.xpath(".//*[@id='book_now']")).click();
}
}
Mai n Class:
public class Mdf_Execution {
public static void main(String[] args) throws Throwable {
// TODO Auto-generated method stub
Md_Tktbooking  a=new Md_Tktbooking();
a.LaunchBrowser();
a.AcessApp();
a.UserLogin();
a.tktBooking();
}
}
Verification point or Assertions: IS USE D TO COMPARE ACTUAL DATA WIT EXPECTED DATA:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class VerificationPoint {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();
wd.get("http://www.adactin.com/HotelAppBuild2/");
String a=wd.getTitle();

if (a.equals("AdactIn.com otel Reservation System"))
{
System.out.println("the tittle is same");
}

else
{
System.out.println("the tittle is not same");
}
wd.close();
}
Data Driven Framework with Excel or how to import the data from flat files (Excel) or Excel objects and Methods:(passing the one or more parameters to the web element at runtime).
package adactinHotels;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import jxl.JXLException;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class DDT_Adactin {
public static void main(String[] args) throws IOException, JXLException, Exception {
// TODO Auto-generated method stub
FileInputStream f=new FileInputStream("D:\\WebdriverKit\\TestData\\Book1.xls");//reading the excel file 
Workbook wb=Workbook.getWorkbook(f);//reading the workbook from file
//Workbook is an interface here
//with the reference of Jxl jar work book interface and methods will work
Sheet ws=wb.getSheet("new");//reading the sheet from workbook
//sheet is interface here// with the reference jxl jar sheet interface and methods will work
int cc=ws.getColumns();//reading the column size this is sheet method
System.out.println(cc);
int rc=ws.getRows();//reading the row size this is sheet method
System.out.println(rc);
for(int i=1;i&lt;=rc;i++)//loop implementation for regression process
{
String Name=ws.getCell(0,i).getContents();//getCell is used to locate the particular cell
//get content is used to fech the value from the particular cell 
System.out.println(Name);
String pwd=ws.getCell(1,i).getContents();//getCell is used to locate the particular cell
//get content is used to fech the value from the particular cell 
System.out.println(pwd);
//Note:getColumns,getRows, getCell,get Contents belongs to sheet interface
System.setProperty("webdriver.chrome.driver","D:\\WebdriverKit\\BrowserDrivers\\Chromedrivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();

wd.get("http://www.adactin.com/HotelAppBuild2/");
Thread.sleep(2000);
wd.findElement(By.xpath(".//*[@id='username']")).sendKeys(Name);
    wd.findElement(By.xpath(".//*[@id='password']")).sendKeys(pwd);
    wd.findElement(By.xpath(".//*[@id='login']")).click();
    Thread.sleep(1000);



}

}
       


}
 objects:
FileInputStream 
Excel objects;
Workbook
Sheet
Methods:
Workbook Method:
getWorkbookSheet Methods:
getsheetgetColumnsgetRowsgetCellgetContentsPropertyFile Concept: or How to import the data from flat files(note pad) or Note pad Objects and Methods:
package adactinHotels;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class Notepad_Adactin {
public static void main(String[] args) throws IOException, Exception {
// TODO Auto-generated method stub
Properties p=new Properties();
FileInputStream f=new FileInputStream("D:\\WebdriverKit\\TestData\\notepaddata.txt");//reading the txt file from specified folder
p.load(f);//Load method is used to load the data from one object to another object 
//or from one file to another file
//load method belongs to Properties object
System.setProperty("webdriver.chrome.driver","D:\\WebdriverKit\\BrowserDrivers\\Chromedrivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();
wd.get("http://www.adactin.com/HotelAppBuild2/");
Thread.sleep(2000);
wd.findElement(By.xpath(".//*[@id='username']")).sendKeys(p.getProperty("un")); //getProperty method is used to get the value from the variable
wd.findElement(By.xpath(".//*[@id='password']")).sendKeys(p.getProperty("pw"));
wd.findElement(By.xpath(".//*[@id='login']")).click();
}
}
Objects:
FileInputStream
Properties
Methods:
Properties methods:
Load
getProperty
 
Reff: https://www.youtube.com/watch?v=g5HyaG3RABgJunit:Theory:
See in ppt’sEg:Demo
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
public class Junit {
@BeforeClass
public static void openApp()
{
System.out.println("logic to open an app");
}
@Before
public void loginMethod()
{
System.out.println("logic for login");
}
@Test
public void BA()
{
System.out.println("Logic to check the balance");
}
@Test
public void depositMethod()
{
System.out.println("logic to deposite the amount");
}
@Test
public void withdrawlMethod()
{
System.out.println("Logic to witdrawl the amount");
}
@After
public void logoutMethod()
{
System.out.println("logic to logout");
}
@AfterClass
public static void closeApp()
{
System.out.println("Logic to close the app");
}
}
Junit  implementation on Project
Sc:1import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class Junit_adactinexample {
WebDriver wd;
@Before
public void LaunchProcess()
{
System.setProperty("webdriver.chrome.driver","D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
wd=new ChromeDriver();
wd.get("http://www.adactin.com/HotelAppBuild2/");
       wd.findElement(By.xpath(".//*[@id='username']")).sendKeys("hemanth123");
       wd.findElement(By.xpath(".//*[@id='password']")).sendKeys("hemanth123");
       wd.findElement(By.xpath(".//*[@id='login']")).click();
}
@Test
public void loginProcess() throws InterruptedException
{

    
        new Select(wd.findElement(By.id("location"))).selectByValue("Sydney");
 new Select(wd.findElement(By.id("hotels"))).selectByIndex(1);
 new Select(wd.findElement(By.xpath(".//*[@id='room_type']"))).selectByIndex(1);

 new Select(wd.findElement(By.xpath(".//*[@id='room_nos']"))).selectByIndex(2);
 wd.findElement(By.xpath(".//*[@id='datepick_in']")).sendKeys("03/07/2018");
 wd.findElement(By.xpath(".//*[@id='datepick_out']")).sendKeys("05/07/2018");
 new Select(wd.findElement(By.xpath(".//*[@id='adult_room']"))).selectByIndex(1); 
 new Select(wd.findElement(By.xpath(".//*[@id='child_room']"))).selectByIndex(2);
 wd.findElement(By.xpath(".//*[@id='Submit']")).click();
 Thread.sleep(1000);

 //Select hotel process
 wd.findElement(By.xpath(".//*[@id='radiobutton_0']")).click();
 wd.findElement(By.xpath(".//*[@id='continue']")).click();
 
 //Booking process
 wd.findElement(By.xpath(".//*[@id='first_name']")).sendKeys("anil");
 wd.findElement(By.xpath(".//*[@id='last_name']")).sendKeys("KUmar");
 wd.findElement(By.xpath(".//*[@id='address']")).sendKeys("Delhi");
 wd.findElement(By.xpath(".//*[@id='cc_num']")).sendKeys("1234567123451212");
 new Select(wd.findElement(By.xpath(".//*[@id='cc_type']"))).selectByIndex(2);

 
 new Select(wd.findElement(By.xpath(".//*[@id='cc_exp_month']"))).selectByIndex(1);
 new Select(wd.findElement(By.xpath(".//*[@id='cc_exp_year']"))).selectByIndex(11); 
 wd.findElement(By.xpath(".//*[@id='cc_cvv']")).sendKeys("159");
 wd.findElement(By.xpath(".//*[@id='book_now']")).click();
}
   
@After
public void LogoutProcess()
{
       wd.findElement(By.linkText("Logout")).click();
        
        wd.quit();
}
SC2:
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class JUnitAdactin1 {
 static WebDriver wd;
@BeforeClass
public static void launch() throws InterruptedException{
    System.setProperty("webdriver.chrome.driver","C:\\Users\\tsuser\\Desktop\\WEB DRIVER KIT\\Browser Drivers\\ChromeDrivers\\chromedriver.exe");

wd=new ChromeDriver();
wd.get("http://www.adactin.com/HotelApp/");
Thread.sleep(1000);
}
@Before
public void login(){
wd.findElement(By.id("username")).sendKeys("tanveer123");
wd.findElement(By.id("password")).sendKeys("tanveer123");
wd.findElement(By.id("login")).click();
}

@Test
public void ticketBooking(){
new Select(wd.findElement(By.id("location"))).selectByValue("Sydney");
new Select(wd.findElement(By.id("hotels"))).selectByIndex(1);
new Select(wd.findElement(By.id("room_type"))).selectByVisibleText("Standard");
new Select(wd.findElement(By.id("room_nos"))).selectByIndex(2);
wd.findElement(By.id("datepick_in")).sendKeys("01/09/2018");
wd.findElement(By.id("datepick_out")).sendKeys("02/09/2018");
new Select(wd.findElement(By.id("adult_room"))).selectByIndex(1);
new Select(wd.findElement(By.id("child_room"))).selectByIndex(3);
wd.findElement(By.id("Submit")).click();
wd.findElement(By.id("continue")).click();
wd.findElement(By.xpath(".//*[@id='radiobutton_0']")).click();
wd.findElement(By.xpath(".//*[@id='continue']")).click();
wd.findElement(By.xpath(".//*[@id='first_name']")).sendKeys("SatyaMounika");
wd.findElement(By.xpath(".//*[@id='last_name']")).sendKeys("Akula");
wd.findElement(By.xpath(".//*[@id='address']")).sendKeys("guntur");
wd.findElement(By.xpath(".//*[@id='cc_num']")).sendKeys("1234567893163456");
new Select(wd.findElement(By.xpath(".//*[@id='cc_type']"))).selectByIndex(2);
new Select(wd.findElement(By.xpath(".//*[@id='cc_exp_month']"))).selectByIndex(5);
new Select(wd.findElement(By.xpath(".//*[@id='cc_exp_year']"))).selectByIndex(5);
wd.findElement(By.xpath(".//*[@id='cc_cvv']")).sendKeys("048");
wd.findElement(By.xpath(".//*[@id='book_now']")).click();
}

@After
public void logout(){
wd.findElement(By.xpath(".//*[@id='logout']")).click();
System.out.println("Logic to logout");
}

@AfterClass
public static void quit(){

      wd.quit();
SC:3@BeforeClass
Launch process
@Bfore
Loginprocess
@Test
methodimplementation_getAttribut
@Test
methodimplementation_getText
@Test
methodimplementation_getTittle
@After
Logoutprocess
Use reference link
@AfterClass
Close browser process
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class JUnitAdactin2 {
 static WebDriver wd;
@BeforeClass
public static void launch() throws InterruptedException{
    System.setProperty("webdriver.chrome.driver","C:\\Users\\tsuser\\Desktop\\WEB DRIVER KIT\\Browser Drivers\\ChromeDrivers\\chromedriver.exe");

wd=new ChromeDriver();
wd.get("http://www.adactin.com/HotelApp/");
Thread.sleep(1000);
}
@Before
public void login(){
wd.findElement(By.id("username")).sendKeys("tanveer123");
wd.findElement(By.id("password")).sendKeys("tanveer123");
wd.findElement(By.id("login")).click();
}

@Test
public void getAttribute(){
new Select(wd.findElement(By.id("location"))).selectByValue("Sydney");
new Select(wd.findElement(By.id("hotels"))).selectByIndex(1);
new Select(wd.findElement(By.id("room_type"))).selectByVisibleText("Standard");
new Select(wd.findElement(By.id("room_nos"))).selectByIndex(2);
wd.findElement(By.id("datepick_in")).sendKeys("01/09/2018");
wd.findElement(By.id("datepick_out")).sendKeys("02/09/2018");
new Select(wd.findElement(By.id("adult_room"))).selectByIndex(1);
new Select(wd.findElement(By.id("child_room"))).selectByIndex(3);
wd.findElement(By.id("Submit")).click();
wd.findElement(By.id("continue")).click();
wd.findElement(By.xpath(".//*[@id='radiobutton_0']")).click();
wd.findElement(By.xpath(".//*[@id='continue']")).click();

wd.findElement(By.xpath(".//*[@id='first_name']")).sendKeys("SatyaMounika");
String y=wd.findElement(By.xpath(".//*[@id='first_name']")).getAttribute("value");
System.out.println(y);

wd.findElement(By.xpath(".//*[@id='last_name']")).sendKeys("Akula");
wd.findElement(By.xpath(".//*[@id='address']")).sendKeys("guntur");
wd.findElement(By.xpath(".//*[@id='cc_num']")).sendKeys("1234567893163456");
new Select(wd.findElement(By.xpath(".//*[@id='cc_type']"))).selectByIndex(2);
new Select(wd.findElement(By.xpath(".//*[@id='cc_exp_month']"))).selectByIndex(5);
new Select(wd.findElement(By.xpath(".//*[@id='cc_exp_year']"))).selectByIndex(5);
wd.findElement(By.xpath(".//*[@id='cc_cvv']")).sendKeys("048");
wd.findElement(By.xpath(".//*[@id='book_now']")).click();

}

@Test
public void getText(){
new Select(wd.findElement(By.id("location"))).selectByValue("Sydney");
new Select(wd.findElement(By.id("hotels"))).selectByIndex(1);
new Select(wd.findElement(By.id("room_type"))).selectByVisibleText("Standard");
new Select(wd.findElement(By.id("room_nos"))).selectByIndex(2);
wd.findElement(By.id("datepick_in")).sendKeys("01/09/2018");
wd.findElement(By.id("datepick_out")).sendKeys("02/09/2018");
new Select(wd.findElement(By.id("adult_room"))).selectByIndex(1);
new Select(wd.findElement(By.id("child_room"))).selectByIndex(3);
wd.findElement(By.id("Submit")).click();
wd.findElement(By.id("continue")).click();
wd.findElement(By.xpath(".//*[@id='radiobutton_0']")).click();
wd.findElement(By.xpath(".//*[@id='continue']")).click();


wd.findElement(By.xpath(".//*[@id='last_name']")).sendKeys("Akula");
wd.findElement(By.xpath(".//*[@id='address']")).sendKeys("guntur");
wd.findElement(By.xpath(".//*[@id='cc_num']")).sendKeys("1234567893163456");
new Select(wd.findElement(By.xpath(".//*[@id='cc_type']"))).selectByIndex(2);
new Select(wd.findElement(By.xpath(".//*[@id='cc_exp_month']"))).selectByIndex(5);
new Select(wd.findElement(By.xpath(".//*[@id='cc_exp_year']"))).selectByIndex(5);
wd.findElement(By.xpath(".//*[@id='cc_cvv']")).sendKeys("048");
wd.findElement(By.xpath(".//*[@id='book_now']")).click();
String x=(wd.findElement(By.xpath(".//*[@id='book_hotel_form']/table/tbody/tr[2]/td"))).getText();
System.out.println(x);

}

@Test
public void getTitle(){
new Select(wd.findElement(By.id("location"))).selectByValue("Sydney");
new Select(wd.findElement(By.id("hotels"))).selectByIndex(1);
new Select(wd.findElement(By.id("room_type"))).selectByVisibleText("Standard");
new Select(wd.findElement(By.id("room_nos"))).selectByIndex(2);
wd.findElement(By.id("datepick_in")).sendKeys("01/09/2018");
wd.findElement(By.id("datepick_out")).sendKeys("02/09/2018");
new Select(wd.findElement(By.id("adult_room"))).selectByIndex(1);
new Select(wd.findElement(By.id("child_room"))).selectByIndex(3);
wd.findElement(By.id("Submit")).click();
wd.findElement(By.id("continue")).click();
wd.findElement(By.xpath(".//*[@id='radiobutton_0']")).click();
wd.findElement(By.xpath(".//*[@id='continue']")).click();
wd.findElement(By.xpath(".//*[@id='first_name']")).sendKeys("SatyaMounika");
wd.findElement(By.xpath(".//*[@id='last_name']")).sendKeys("Akula");
wd.findElement(By.xpath(".//*[@id='address']")).sendKeys("guntur");
wd.findElement(By.xpath(".//*[@id='cc_num']")).sendKeys("1234567893163456");
new Select(wd.findElement(By.xpath(".//*[@id='cc_type']"))).selectByIndex(2);
new Select(wd.findElement(By.xpath(".//*[@id='cc_exp_month']"))).selectByIndex(5);
new Select(wd.findElement(By.xpath(".//*[@id='cc_exp_year']"))).selectByIndex(5);
wd.findElement(By.xpath(".//*[@id='cc_cvv']")).sendKeys("048");
wd.findElement(By.xpath(".//*[@id='book_now']")).click();
         String z=wd.getTitle();
         System.out.println(z);
}


@After
public void logout(){
wd.findElement(By.linkText("Logout")).click();
wd.findElement(By.xpath("html/body/table[2]/tbody/tr/td[1]/table/tbody/tr/td/a")).click();
}

@AfterClass
public static void quit(){

      wd.quit();
}
}
Advanced selenium :TestNG:Theory: refer ppts (concentrate more on deferences between junit and TestNG)
TextNG Demo:
       package headofficepkg;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class TestNG {

@BeforeClass
    public static void openapp()
{
System.out.println("logic to open an app");
}
@BeforeMethod
public void login()
{
System.out.println("logic for login");
}
@Test(priority=2) 
public void BA()
{
 System.out.println("logic to check the balance");
}
@Test (enabled=false)
public void DEP()
{
System.out.println("logic to deposit the cash");
}
@Test (priority =1) 
public void WD()  
{
System.out.println("logic to withdrawl the cash");
}
@AfterMethod
public void logout()
{
System.out.println("logic for logout");
}
@AfterClass
public static void closeapp()
{

System.out.println("logic to close an app");

}
}
 Difference between Junit and TestNG
                    Junit                      TestNG
Internal frame work External frame work
Support for annotation Support for annotation
Doesn’t support for prioritization Supports prioritization
Doesn’t  support for report Support for report generation
We can use @Ignore to ignore a particular method at run time Instead of using @Ignore we can use the method (enabled = false)
Instead of using @before in Junit  we 
Can use @BeforeMethod  Instead of using @before in Junit  we 
Can use @BeforeMethod
@BeforeClass &amp; @AfterClass are static @BeforeClass &amp; @AfterClass are static
It doesn’t support  to execute the test suite support  to execute the test suite(@TestSuite)
We can’t get the  data directly from database  I t has given dataprovider to get the data directly from database.
TextNG implementation in Project:
Actions:How to Handle MouseOver?
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
public class Actions_Mouseover {
public static void main(String[] args) throws Throwable {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "D:\\WebdriverKit\\BrowserDrivers\\ChromeDrivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();
wd.get("http://www.richasoft.com/");

WebElement mov=wd.findElement(By.id("menu-item-456"));
Actions ac=new Actions(wd);
ac.moveToElement(mov).build().perform();
Thread.sleep(2000);
wd.findElement(By.xpath("//li[@id='menu-item-486']/a[1]")).click();


}
}
Actions Class:How to Handle Drag and Drop operations?
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
public class Actions_Drag_Drop {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "D:\\WebdriverKit\\BrowserDrivers\\ChromeDrivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();
wd.get("https://jqueryui.com/droppable/");

wd.switchTo().frame(0);

WebElement SE=wd.findElement(By.id("draggable"));
WebElement TE=wd.findElement(By.id("droppable"));
Actions ac=new Actions(wd);
ac.clickAndHold(SE).moveToElement(TE).release().build().perform();



}
}
Alert Class:How to handle Alert msgs? Or How to handle pop-ups?
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class AllertMsg {
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();
wd.get("https://mail.rediff.com/cgi-bin/login.cgi");
wd.findElement(By.name("proceed")).click();
Thread.sleep(5000);
//on this pop  we can perform two activities
//Get Text of pop up msg
//and then click on ok button
Alert al=wd.switchTo().alert();
String a=al.getText();
System.out.println(a);
al.accept();
//al.dismiss();
}
Cross browser testing Theory:
Is used to verify whether our web application can work in deferent browsers or not.
Why Cross browser testing:
The webdriver API drives the web browser as the real browser would drive it.
By default Firefox driver comes with selenium Standardalone .jar library added.
For Chrome, IE, Suffari, opera etc have libraries that need to initiate externally.
How to conduct cross browser testing in selenium webdriver.
a.Element Locators: same for all browsers.
b.WebDriver commands: same for all browsers.
c.Programming features: same for all browsers.
d.TextNg,Junit  Annotations:same for all browsers.
e.Browser drivers: which will vary from one another.
F: Inspect element:
For Mozilla: ( Inspect Element)
For  Chrome: (Inspect)
We have other developer  tools also available.
Testcase: verify Launch application in all the browsers 
Steps:
Launch the browser with empty urlNavigate to “url”
Cross Browser Compatibility Testing Implementation in Project:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class CrossBrowser {
public static WebDriver wd;
public static int B;
public static String BN;
public static void main(String[] args) {
for ( B=1; B&lt;=2; B++)
{
if (B==1)
{
System.setProperty("webdriver.chrome.driver","D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
    wd=new ChromeDriver();
BN="Chrome Browser";

}

else if (B==2)
{
System.setProperty("webdriver.gecko.driver","D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\geckodriver.exe");
 wd=new FirefoxDriver();
BN="FirefoxBrowser";
}

wd.get("http://www.adactin.com/HotelAppBuild2/");
String a=wd.getTitle();

if (a.equals("AdactIn.com - Hotel Reservation System"))

{   
System.out.println("the tittle is same" );
System.out.println("Goole application launched and passed" +BN);

}

else
{
System.out.println("the tittle is not same");
System.out.println("Goole application launched and passed" +BN);
}
wd.close();

}
}

}
Window methods or ManageMethods: are used to manage the windows
package adactinHotels;
import java.lang.reflect.Type;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriver.Window;
import org.openqa.selenium.chrome.ChromeDriver;
public class WindowMethods {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","D:\\WebdriverKit\\BrowserDrivers\\Chromedrivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();

//how to get the Height of the window
wd.get("http://www.adactin.com/HotelAppBuild2/");
int a=wd.manage().window().getSize().getHeight();//used to get height of the window
System.out.println(a);

//how to get the Width of the window
int b=wd.manage().window().getSize().getWidth();//used to get Width of the window
System.out.println(b);
             Point d=wd.manage().window().getPosition();
             System.out.println(d);//is used to get window position
             
             Set&lt;Cookie&gt; e=wd.manage().getCookies();
             System.out.println(e);//is used to handle the cookies

             //How to Maximize the Window
wd.manage().window().maximize();//Maximize method is used to maximize the widow
//How to fullscree the window
wd.manage().window().fullscreen();//fullscreen method is used to fullscreen the window
             
             int f=wd.manage().window().hashCode();
             System.out.println(f);//is used to get WindowID
           
      Type c=wd.manage().window().getClass();
      System.out.println(c);//is used to get the current methods Web driver class
            
             
      
     
}
}
Actions_How to Capture the screenshot:
package adactinHotels;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class ScreenShot1 {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "D:\\WebdriverKit\\BrowserDrivers\\ChromeDrivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();
wd.manage().window().maximize();
wd.get("https://www.facebook.com/");
wd.findElement(By.xpath("//input[@id='email']")).sendKeys("testing project");
TakesScreenshot ts=(TakesScreenshot)wd;//TakesScreenshot is an Interface here 
File  source=ts.getScreenshotAs(OutputType.FILE);//is used to get Screen shot at runtime
System.out.println("screenshot taken");
FileUtils.copyFile(source,new File("D://google.png"));//copy of file is used to transfer the data from one location to another new location)
System.out.println("now your screen shot is ready to view in specified location");
//you can also create folder in project(right mouse on project-folder-enter the foldername)
//to save in folder (FileUtils.copyFile(source,new File("./foldername/filename"));
//to view your file find your created folder in your project click on refresh button .
wd.quit();
}
}
Actions_How to Perform RightClick:
package adactinHotels;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import or g.openqa.selenium.interactions.Actions;
   
How to write dynamic xpath:
locate any element by using "inspect" options by right click on the element.
use ctrl+F to validate Xpath 
site: FaceBookLogin
Xpath:1basic xpath syntax:
//htmltag[@property='value']
eg for facebook username
//input[@type='email']
//input[@name='email']
//input[@id='email']
//input[@class='inputtext']
eg for facebook password
//input[@type='password']
//input[@name='pass']
//input[@id='pass']
//input[@class='inputtext']
eg: for Login:
//input[@type='submit']
//input[@Value='Log In']
//input[@id='u_0_8']
note: if we want to ignore tagname if you will get confused to understand  htmlTagname. 
just use * inplace of tagname.
eg: for facebook username
//*[@type='email']
//*[@name='email']
//*[@id='email']
//*[@class='inputtext']
***NOte: * is regular expression here.
Xpath:2How to write xpath using multi properties.(if we have same property for two defferent elements then system may locate only the first 
element) then with the help of multi properties system can recognise the elements.
explonation: 
facebook username:   //input[@class='inputtext']
facebook password:   //input[@class='inputtext']
IFthis is the case system locate only username as above we have given same property .for face book password:  //input[@class='inputtext' and @type='password' and @id='pass']
then it will be recognise password also.
Xpath:3----regular expressions(when the value is very Lengthy) then we can ask system to locate element with matching information.
eg:fb login button:
//input[contains(@type,'submit')]
eg for facebook username
//input[Contains(@type,'email']
//input[Contains(@name,'email']
//input[Contains(@id,'email']
//input[Contains(@class,'inputtext']
Xpath4:
Links:when we are working with links you can prefer this.
syntax:1
//htmltag[text()='linkname']
//a[text()='Forgotten account?']
Syntax:2(with regular expression)
//htmltag[contains(text(),'linkname')]
//a[contains(text(),'Forgotten account?')]
How to write dynamic CSS:
css1:
tagName[attribute='value']
eg:Facebook username:
input[ name='email']
if we want to ignore tagname in css just ignore  tagname and then write remaining syntax.
eg://[name='email']
css2:
tagName#id(if we have id then only we have to use this syntax)
eg:facebook username:
input#email
css3:
tagName.classValue
Input. inputtextcss4: 
regular expression(when the value is very Lengthy)
tagName[Attribute*='value']
eg:Facebook username:
input[ name*='email']
Mavens Integrations:
==================
Page Object Model:
=================
Page object model is element design Pattern it’s not a Frame work using this concept we can create element repository .i.e we can create container classes or centralized repository for elements.
Process: 
1.Create Page class in this design elements along with locators.
2.Under this we can create constructor with argument (argument type is webdriver).
3.Under this we can create methods.
4.In main method we can call argument  constructor by  creating object of PageClass.
5. Call the methods of Page Class by passing argument values using object(using page class object) .
//****PageClass: for each page we can create one page class in this we can create elements for the particular page along with Locators AND also we can design Methods with respect to our operations.******
Types of POM:
1.POM without Page Factory
2.POM with Page Factory
Advantages:
*Centralized maintenance of elements or centralized element repository.
*Reusability of elements so that we can reduce the code size.
*IT is efficient and scalable.
package headofficepkg;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
//Page object model is element design Pattern its not a Frame work using this concept we can create element repository .//i.e we can create container classes or centralized repository for elements.
//under this we can create constructor 
//under this we can create methods
//from main class we can directly call this methods by passing constructor values
//the overall advange of page object model is best used for regression testing by passing the parameters from main classes instead of genarating multiple scripts .//****PageClass: for each page we can create one page class in this we write elements for particular page along with Locators AND also we can design Methods with repect to our operations.******
//Types of POM
//POM without Page Factory
//POM with Page Factory
//Advantages of Page Object Model
//Reusability of Elements, reduces code size
//It is efficient and scalable
//Centralized Maintenance of Elements/Objects
PageClass: or Container:
public class POM_PageClass {
WebDriver wd;
By un=By.id("username");
By pw=By.id("password");
By sub=By.id("login");
public  POM_PageClass(WebDriver wd)//wd: is argument and it is webdriver type but not string or int or something type.
{
this.wd=wd;//from main method if we are passing the values will be stored in to constructor variable"wd" and will be given to Class variable "wd"
//Constructor follows Method syntax
//Constructor name as class name
//it doent required void 
//it doent return any thing

}
public void typeUsername(String uname)//uname: when u import the  method from your main class the method will ask u to enter the value in to "uname"
{
wd.findElement(un).sendKeys(uname);
}
public String captureUsername()
{
return wd.findElement(un).getAttribute("value");//after getting the value from username the same will be return to the output to main class
}
public void clearUsername()
{
wd.findElement(un).clear();
}
public void typePassword(String pwd)
{
wd.findElement(pw).sendKeys(pwd);
}
public void clikLogin()
{
wd.findElement(sub).click();
}
}
MainClass:
package headofficepkg;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class POM_TestCase {
public static void main(String[] args) throws Throwable {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver","D:\\Anilwork\\Anil-selenium\\Sel_Binding\\Browser drivers\\chromedriver.exe");
WebDriver abc=new ChromeDriver();//to differentiate main class variable with method variables and constructor variables we are using different variable"abc"
Thread.sleep(3000);
abc.manage().window().maximize();
POM_PageClass login=new POM_PageClass(abc);

abc.get("http://www.adactin.com/HotelAppBuild2/");

login.typeUsername("Anilkumar123");
String result=login.captureUsername();
System.out.println(result);


login.typePassword("Anilkumar123");
login.clikLogin();

}
}
Keyword Driven FrameWork:
Is used to reduce the efforts
Even manual test engineers also can write the script using some keywords.
package adactinHotels;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
import jxl.JXLException;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class Keyworddriven {
public static void main(String[] args) throws IOException, JXLException, Throwable {
// TODO Auto-generated method stub
FileInputStream f=new FileInputStream("D:\\WebdriverKit\\TestData\\keyworddata.xls");//reading the excel file 
Workbook wb=Workbook.getWorkbook(f);//reading the workbook from file
//Workbook is an interface here
//with the reference of Jxl jar work book interface and methods will work
Sheet ws=wb.getSheet("key");
int rc=ws.getRows();
System.out.println(rc);
int cc=ws.getColumns();
System.out.println(cc);

System.setProperty("webdriver.chrome.driver","D:\\WebdriverKit\\BrowserDrivers\\Chromedrivers\\chromedriver.exe");
WebDriver wd=new ChromeDriver();

for(int i=1;i&lt;=rc;i++)
{
String Operation=ws.getCell(0,i).getContents();//getCell is used to locate the particular cell
//get content is used to fech the value from the particular cell 

System.out.println(Operation);

String Element=ws.getCell(1,i).getContents();//getCell is used to locate the particular cell
//get content is used to fech the value from the particular cell 
System.out.println(Element);
//Note:getColumns,getRows, getCell,get Contents belongs to sheet interface
String Value=ws.getCell(2,i).getContents();
System.out.println(Value);
//out put in first iteration.
//Operation=enter
//element=username
//value=Anilkumar123

switch(Operation){

case "Enter":
wd.findElement(By.id(Element)).sendKeys(Value);
break;
case "Click":
wd.findElement(By.id(Element)).click();
break;
case "Get":
wd.get(Value);


}
Thread.sleep(2000);

    Thread.sleep(1000);
}
}
}
Note: first we have to create data base in excel as shown below:


Complete all the assignments before going to attend the interview)
Assignments:
1.what is autoit and how to import and report a file in autoit.
2.what is the use of jenkins in selenium(Just try to know how to integrate Jenkins with Maven).
3.what is API testing.
4.what is appiem.