com.atlassian.pageobjects.elements
Interface PageElement

All Superinterfaces:
PageElementFinder
All Known Subinterfaces:
CheckboxElement, MultiSelectElement, SelectElement
All Known Implementing Classes:
WebDriverCheckboxElement, WebDriverElement, WebDriverMultiSelectElement, WebDriverSelectElement

@PublicApi
public interface PageElement
extends PageElementFinder

Represents an HTML element that is expected on a DOM of a page.

Since:
2.0

Method Summary
 PageElement clear()
          Clear the value of the text entry element.
 PageElement click()
          Click this element
 PageElement find(org.openqa.selenium.By locator)
          

Returns an element that will match the given locator within this element.

 List<PageElement> findAll(org.openqa.selenium.By locator)
          Returns a list of element's that match the given locator within this element
 String getAttribute(String name)
          Get the value of the given attribute of this element.
 org.openqa.selenium.Point getLocation()
          Location of this element on the page (top-left corner)
 org.openqa.selenium.Dimension getSize()
          Dimension of this element on the page
 String getTagName()
          Get the tag name of this element
 String getText()
          Get the visible innerText of this element, including sub-elements, without any leading or trailing whitespaces.
 String getValue()
          Get the value of this element's "value" attribute.
 boolean hasAttribute(String name, String value)
          Whether this element has an attribute set to a specific value
 boolean hasClass(String className)
          Whether this element has the given class set
 boolean isEnabled()
          Whether this element is enabled on the page
 boolean isPresent()
          Whether this element is currently on the DOM of the page
 boolean isSelected()
          Whether this element is selected on the page.
 boolean isVisible()
          Whether this element is visible on the page
 PageElementJavascript javascript()
          Gets a PageElementJavascript for this element
 PageElement select()
          Select an element.
 TimedElement timed()
          Creates a timed element based on this element's locator.
 PageElement toggle()
          If the element is a checkbox this will toggle the elements state from selected to not selected, or from not selected to selected.
 PageElement type(CharSequence... keys)
          Simulate typing into this element.
 PageElement withTimeout(TimeoutType timeoutType)
          Returns an instance equivalent to this element, with a changed timeoutType.
 
Methods inherited from interface com.atlassian.pageobjects.elements.PageElementFinder
find, find, find, findAll, findAll, findAll
 

Method Detail

isPresent

boolean isPresent()
Whether this element is currently on the DOM of the page

Returns:
True if this element tag exists in the DOM, false otherwise.

isVisible

boolean isVisible()
Whether this element is visible on the page

Returns:
true if this element is visible on the page, false otherwise.

isEnabled

boolean isEnabled()
Whether this element is enabled on the page

Returns:
True if this element is enabled, false otherwise.

isSelected

boolean isSelected()
Whether this element is selected on the page. Useful on checkboxes and radio buttons. For checkboxes, returns true if the checkbox is checked. For radio buttons, returns true if the radio button this class represents is selected.

Returns:
True if this element is selected, false otheriwse.

hasClass

boolean hasClass(String className)
Whether this element has the given class set

Parameters:
className - The name of the class to check
Returns:
true if this element's class attribute contains the given classname, false otherwise.

getAttribute

String getAttribute(String name)
Get the value of the given attribute of this element.

Parameters:
name - The name of the attribute.
Returns:
The attribute's current value, or null if the value is not set

hasAttribute

boolean hasAttribute(String name,
                     String value)
Whether this element has an attribute set to a specific value

Parameters:
name - The attribute name
value - The expected value
Returns:
true if attribute is set to the specific value, false otherwise or if attribute is not present

getText

String getText()
Get the visible innerText of this element, including sub-elements, without any leading or trailing whitespaces.

Returns:
The innerText of this element.

getTagName

String getTagName()
Get the tag name of this element

Returns:
The tag name

getValue

String getValue()
Get the value of this element's "value" attribute.

Returns:
The value of this element's "value" attribute, or null if the value is not set.

getLocation

org.openqa.selenium.Point getLocation()
Location of this element on the page (top-left corner)

Returns:
location of the element on the page

getSize

org.openqa.selenium.Dimension getSize()
Dimension of this element on the page

Returns:

click

PageElement click()
Click this element

Returns:
The eleemnt that got clicked.

type

PageElement type(CharSequence... keys)
Simulate typing into this element. This will append the keystrokes to the end of the text entry element.

Parameters:
keys - keys to type
Returns:
The Element that got typed in.

select

PageElement select()
Select an element. This method will work against radio buttons, "option" elements within a "select" and checkboxes

Returns:
The Element that got selected

toggle

PageElement toggle()
If the element is a checkbox this will toggle the elements state from selected to not selected, or from not selected to selected.

Returns:
The Element that got toggled

clear

PageElement clear()
Clear the value of the text entry element.

Returns:
The Element that got cleared.

findAll

List<PageElement> findAll(org.openqa.selenium.By locator)
Returns a list of element's that match the given locator within this element

Specified by:
findAll in interface PageElementFinder
Parameters:
locator - The locator mecharnism
Returns:
A list of elements that are located within this element.

find

PageElement find(org.openqa.selenium.By locator)

Returns an element that will match the given locator within this element.

This method will always return an element instance. Use isPresent() to check whether a corresponding element on the page actually exists.

Specified by:
find in interface PageElementFinder
Parameters:
locator - The locator mechanism
Returns:
An element that will be located within this element.

timed

TimedElement timed()
Creates a timed element based on this element's locator.

Returns:
A TimedElement that is based on this element's locator.

javascript

PageElementJavascript javascript()
Gets a PageElementJavascript for this element

Returns:
API to execute javascript on this element.

withTimeout

PageElement withTimeout(TimeoutType timeoutType)
Returns an instance equivalent to this element, with a changed timeoutType.

Parameters:
timeoutType - new timeout
Returns:
new element with given timeoutType


Copyright © 2014 Atlassian. All rights reserved.