-
Notifications
You must be signed in to change notification settings - Fork 7
Locating Elements
Brandon Donnelson edited this page Sep 4, 2013
·
1 revision
Using the WebDriver to find elements in the application.
###Examples
##Reference
- FasterByChained Javadoc
- CheatingByChained Javadoc
##Finding Elements The Selenium driver provides the traditional element search and GWT Driver adds the ability to search for the element by looking for the widget by name.
- Finding the body element using Selenium
By
.
WebElement bodyElement = driver.findElement(By.tagName("body"));
- Finding a element using GWT Driver
By
. Note that the better the XPath delineation the better the speed in finding the desired element. One of the greedier XPath searches is .//* finding all the possible sibling elements.
WebElement hlcElement = driver.findElement(
new FasterByChained(By.xpath(".//div/*"), new ByWidget(driver,
com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer.class)));
##Finding Elements with XPath XPath provides the starting point of the DOM element search for the Widget class name. XPath can be iterative expensive so defining a specific XPath is beneficial to providing a faster element search.
- This is an example of how to provide the XPath starting point to the element search.
WebElement hlcElement = driver.findElement(
new FasterByChained(By.xpath(".//div/*"), new ByWidget(driver,
com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer.class)));
##Thanks to: Sencha.com
Download
Maven Configuration
Docs
Locating Widgets
Locating Elements
Driver Design
Models
Extends
GWT Driver Wiki Home