0% found this document useful (0 votes)
5 views

WebDriver-introduction

Web Driver is a functional testing component in Selenium used for testing web applications across various browsers and programming languages. It supports methods for page navigation, element interaction, and window management, along with locators to identify web elements. Installation requires Java and specific Selenium jar files, and projects can be organized in Eclipse with packages and classes.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

WebDriver-introduction

Web Driver is a functional testing component in Selenium used for testing web applications across various browsers and programming languages. It supports methods for page navigation, element interaction, and window management, along with locators to identify web elements. Installation requires Java and specific Selenium jar files, and projects can be organized in Eclipse with packages and classes.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Web driver

This is a functional testing component in selenium, which is used to


test web applciations
Using web driver we can test any no of pages, browsers in a single
o.s with latest version
Web driver supports programming languages like : java /
ruby/python/perl php and c#
Cross browser, parallel testing is possible by using TestNG or Junit
Framework design is possible by TestNG
The reports can be generated in the form of .xml file

Methods and locators in web driver are:

 Methods( Operations)
 Locators( properties of objects)

Methods in selenium web driver are:


1) Get(): to invoke or to call an application
Syntax:
Obj.get(url);
Example:
Obj.get(http://www.amazon.com);
2) Navigate().to(): to invoke or to call an applications
Syntax:
Obj.navigate().to(url);
Example:
Obj.navigate().to(“http://www.amazon.com”);
3) Maximizing: to max the current window
Syntax:
Obj.manage().window(),maximize();
4) Gettitle(): to get the current page title.
Syntax:
Obj.gettitle();
System.out.println(obj.gettitle());
Note:
To print a statement in java we use : system.out.println();
Or
String t1=obj.gettitle();
System.out.println(t1);
5) Getcurrenturl(); to get the current page url

Syntax:
Obj.getcurrenturl();
System.out.println(obj.getcurrenturl());

Or
String t2=obj.getcurrenturl();
System.out.println(t2);

6) Forward(): to move to next page window


Syntax:
Obj.navigate().forward();
7) Back(): to move to previous page
Syntax:
Obj.back();
8) Refresh(): to refresh the current page
syntax
obj.navigate().refresh();
9) findElement(): to capture a particular element from the
current window

syntax:

obj.findElement(By.locator(locatorvalue)).operations();

10) findElements: to capture multiple elements which are


related to a single functionality
examples: links , radio buttons, check boxes, dropdown
elements
syntax:
obj.findElements(By.locator(locatorvalues());
11) quit ():to close the current window
syntax:
obj.quit();
12) close(); to close all the window
syntax:
obj.close();

locators in web driver are:


 id
 name
 classname
 tagName
 linkText
 xpath
 csslocator
man : object
name, color, height, address, contact no ,email id ,

Installation process:
Java / jre1.7 jdk 1.7 selenium-server-standalone-2.53.0 jar files/
eclipse

In eclipse :
 Create project ------------------collection of packages (yahoo
page)
 Create package ------------------collection of classes ( inbox )
 Create class ====================single program
(checkbox)
Import a jar file into project ( selenium-server-standalone-2.53.o) jar
file

*.

You might also like