Android apps to use in appium android test examples


Monday, September 18, 2017

Selenium DDF : Creating Functions To Locate Elements By All Locator Types

We convey Implemented getElementByXPath business office to locate chemical cistron yesteryear XPath In PREVIOUS STEP. As yous know, There are many dissimilar chemical cistron locators available In spider web driver. So obviously, Sometimes yous needs to locate elements yesteryear other locator types every bit good ( cssSelector, ID, Name etc..) when It Is non possible to locate chemical cistron yesteryear XPath. Let us Implement those functions In our DDF.


Prerequisite : All previous information driven framework creation steps should last Implemented. You tin larn listing of steps alongside links on THIS PAGE.

How To Implement
In this step, We volition Implement dissimilar functions for dissimilar chemical cistron locator types to locate spider web page elements. We convey already Implemented getElementByXPath business office In previous footstep as well as then I intend no to a greater extent than detailed description required. We convey to utilisation same matter In all other locators functions too. We convey to Implement all these functions In file as well as then that nosotros tin access them In our all exam cases. I convey Implemented bellow given novel functions In file.
  • getElementByID -> To locate chemical cistron yesteryear ID locator.
  • getElementByName ->  To locate chemical cistron yesteryear Name locator.
  • getElementByCSS ->  To locate chemical cistron yesteryear cssSelector locator.
  • getElementByClass ->  To locate chemical cistron yesteryear Class locator.
  • getElementByTagName ->  To locate chemical cistron yesteryear tagName locator.
  • getElementBylinkText ->  To locate chemical cistron yesteryear linkText locator.
  • getElementBypLinkText ->  To locate chemical cistron yesteryear Partial linkText locator.
All these functions volition utilisation telephone commutation of chemical cistron which Is stored Inside file. Using value of that key, It volition locate the element.

Download Required Files
You convey to download modified and files. Download bellow given aught folder to larn all of them.
Extract the aught folder as well as supercede all 3 files alongside existing files In eclipse. View, file to know how all inward a higher house functions are Implemented as well as sentiment to know how few of them(Example getElementByName, getElementByID, getElementByCSS) are used In our exam case. If yous know, Previously nosotros convey used getElementByXPath function to click on buttons as well as larn text from text box. Now, few of those lines are modified using inward a higher house functions.

If yous view file, I convey created dissimilar blocks for all dissimilar locators types to shop as well as create create them In proper way. This construction volition helps yous to bring out whatever locator really easily In future.

Run Test
Run exam using "Shortcut to Run Test.bat" file from desk superlative as well as notice execution as well as results.

What We Have Achieved In This Step
We convey Implemented all inward a higher house described functions to locate the elements using dissimilar chemical cistron locating methods. We convey also modified file to keep dissimilar types of chemical cistron objects In expert manner. It volition assistance us to keep all chemical cistron objects really easily.

More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM

No comments:

Post a Comment