ExtWebDriver provides a library of HTML element classes which are commonly used for running test scenarios. When you need to interact with elements on a page, or get information from elements such as the text value, you can simply use one of the widget classes within the widget library. Following are the available widget classes:

Base Elements
  • Element
  • InteractiveElement
Static Elements
  • HtmlList
  • Image
  • Table
Interactive Elements
  • Button
  • CheckBox
  • DropDown
  • HyperLink
  • Input
  • InteractiveHtmlList
  • RadioButton
  • Select

When you instantiate a new widget object, you need to construct it with a locator string such as an XPath, CSSSelector, id, name. ExtWebDriver will automatically parse the locator string and use it to locate the element on the DOM. Since the provided widget classes represent HTML elements, the locator string must match HTML element locators (refer to API Doc for more information). To effectively manage all of the locator string you are using to test your application, you can use the GUI Properties feature to maximize reusability.

Table Widget Example:

  *  Sample Test
 public class SampleTableTest {

    public void testTableElement() {
      // Setup session and open up application under test
      // Create Table object
      ITable t = new Table("//table[@id='myTable']");
      // Wait for existence of the table
      // Validate the count of rows
      Assert.assertEquals(10, t.getTableRowCount());
      // Validate item existence
      Map item = new HashMap();
      item.put("Header1", "Value1");
      item.put("Header2", "Value2");      			

You have the flexibility to extend the widget library by adding your own set of widget classes or provide your own implementation of the existing widget classes.