Android apps to use in appium android test examples


Thursday, July 12, 2018

Selenium WebDriver Quick Tutorial

Selenium WebDriver Quick Tutorial

i) Introduction to Selenium WebDriver

ii) Selenium WebDriver Environment Setup

iii) Web Elements too Operations

iv) Element Locators

v) WebDriver API Commands
i) Introduction to Selenium WebDriver

> Selenium WebDriver is a programming Interface, no IDE

> Selenium WebDriver supports diverse Programming Languages to write programs (Test Scripts)

> Selenium WebDriver supports diverse Operating Environments.

> Selenium WebDriver supports diverse Browsers to exercise too execute Test Cases.

> Using Element Locators too WebDriver Commands nosotros tin terminate exercise Test Cases.

> Its back upward Batch Testing, Cross Browser Testing too Data Driven Testing
Drawbacks of Selenium WebDriver

> It doesn't cause got IDE, too then hard to exercise Test cases too takes to a greater extent than time.

> It doesn't cause got built-in Result Reporting facility.

> No Tool integration for Test Management.
ii) Selenium WebDriver Environment Setup


i) Download too install Java (JDK) software. - To exercise too execute programs (Test scripts)

ii) Download Eclipse IDE too extract. - To write too execute Java programs.
iii) Download Selenium WebDriver Java Language binding (from too add together WebDriver jounce files to Java projection inwards Eclipse IDE.
v) Firefox Driver is default driver inwards Selenium Webdriver, for IE, Chrome too Safari etc... Browsers nosotros ask to download browser drivers too gear upward path.
Manual Test Case:

Test Case ID: gcrshop_admin_TC001

Test Case Name: Verify Admin Login inwards GCR Shop spider web portal

Test Steps:
i) Launch the Browser too navigate to ""
ii) Enter User name
iii) Enter Password
iv) Click "Login" Button

Input Data / Test Data:
User cite =admin
Password = admin@123

Verification Point:
Capture the Url (Actual) afterwards Login to Application too Compare amongst Expected.

Expected URL: ""

Test Result: 
1) Element Locators - To Identify the Elements

Example for Elements: Link, edit box, Button etc...
Examples for Operations on Elements: Click, Enter a Value, Check, select etc...

2) WebDriver Commands - Perform Operations on Elements

3) Java Programming - To heighten Test cases
Object / Element Property/Locator Value
Man name Santosh
height 6
Object name abc
Dog color white
weight 5
Edit box name Email
Button id tdb1
Selenium WebDriver Test Case:

public static void main(String[] args) {
WebDriver driver = novel FirefoxDriver();//Launches Firefox Browser amongst blank url.
driver.get("");//Naviage to Admin domicile page

String url = driver.getCurrentUrl();

if (url.equals("")){
System.out.println("Login Successful - Passed");
else {
System.out.println("Login Unsuccessful - Failed");
driver.close();//Closes the Browser
iii) Web Elements too Operations on Elements

a) WebElements

Edit box
Image, Image Link, Image Button
Text Area
Check box
Radio Button
Drop downward box
List box
Combo box
Web Table/ HTML Table
b) Operations on Elements

i) Browser
(Launch Browser, Navigate to specified URL, Navigate back, Navigate forward, refresh, closed Browser....)

ii) Page
(Return Page Title, Return Page URL...)

iii) Link
(Click, Check the existence, Check Enabled condition ....)

iv) Button

(Click, Check Displayed status, Enabled status, provide push cite ....)

v) Image
a) General Image (Return Image Title etc...
b) Image Button (Click, Check Displayed status, Enabled status, provide push cite ....)
c) Image Link (Click, Check the existence, Check Enabled condition ....)

vi) Text Area / Error Message

(Return Text Area/ Return Error Message etc...)

vii) Radio Button
(Check Displayed status, Enabled status, Select....)

viii) Check box
(Check Displayed status, Enabled status, Select, Unselect, cheque Selected status....)

ix) Drop downward box
(Check Displayed status, Enabled status, Select an Item, Get Items Count ....)

x) List Box
(Check Displayed status, Enabled status, Select i or to a greater extent than Items, Get Items Count ....)

xi) Combo box 
(Check Displayed status, Enabled status, Select an Item, Enter an Item, Get Items Count ....)

xii) Web Table
(Return specified Cell value, Return Rows Count, Column Count etc...)

xiii) Frame 
(Switch from Top window to specified frame, Frame to Top window

inLine Elements
iv) Element Locators

What is Locator?

> It is an address that identifies a Web chemical ingredient uniquely inside the page.

Selenium supports 8 Element locators to recognize elements inwards spider web pages.









By.elementLocator("element locator value")


driver -Browser Object

findElement- WebDriver Method / Command

By - Built inwards Class

id - Locator

Email - Value

sendKeys -WebDriver Method / Command

India - Input Data







v) WebDriver Commands / Methods

> Selenium WebDriver methods/commands are used to perform operations on Web Elements.

> Using Element Locators too WebDriver Methods nosotros exercise Test Cases.

Element Locators - To recognize / Identify Elements

WebDriver Methods - To perform operations on Elements
Important WebDriver API Commands

1) get() - Opens a specified URL inwards the Browser window.

2) getTitle() - Returns the Browser Title.

String Title = driver.getTitle();
3) getCurrentUrl() -  Returns Current URL of the Browser

String Url = driver.getCurrentUrl();
4) navigate().to() - Loads a novel page inwards the electrical flow browser window.

5) navigate().back() - It moves a unmarried especial dorsum inwards the Browser history.

6) navigate().forward() - It moves unmarried especial frontwards inwards the browser history.

7) navigate().refresh() - Refreshes the Current spider web page

8) close() - Closes the focused Browser.

9) findElement() - Finds the get-go Element inside the electrical flow page using given locator.

10) sendKeys() - Enters a value into Edit box/Text box.

11) clear() - It clears the value from Edit box

12) click() - Clicks an Element (Buttons, Links etc...)

13) isEnabled() - Checks conditions the Element is inwards Enabled field or not?

boolean a = driver.findElement("next")).isEnabled();
14) isDisplayed() - Checks conditions the Element is displayed or not?

boolean a = driver.findElement(By.linkText("Gmail")).isDisplayed();
15) isSelected() - Checks conditions the Element is selected or not?

boolean afterwards = driver.findElement(By.xpath("html/body/input[3]")).isSelected();


No comments:

Post a Comment