\WebDriverElement

Interface for an HTML element in the WebDriver framework.

Summary

Methods
Constants
findElement()
findElements()
clear()
click()
getAttribute()
getCSSValue()
getLocation()
getLocationOnScreenOnceScrolledIntoView()
getSize()
getTagName()
getText()
isDisplayed()
isEnabled()
isSelected()
sendKeys()
submit()
getID()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

findElement()

findElement(\WebDriverBy  $locator) : \WebDriverElement

Find the first WebDriverElement within this element using the given mechanism.

Parameters

\WebDriverBy $locator

Returns

\WebDriverElement —

NoSuchElementException is thrown in HttpCommandExecutor if no element is found.

findElements()

findElements(\WebDriverBy  $locator) : array

Find all WebDriverElements within this element using the given mechanism.

Parameters

\WebDriverBy $locator

Returns

array —

A list of all WebDriverElements, or an empty array if nothing matches

clear()

clear() : \WebDriverElement

If this element is a TEXTAREA or text INPUT element, this will clear the value.

Returns

\WebDriverElement —

The current instance.

click()

click() : \WebDriverElement

Click this element.

Returns

\WebDriverElement —

The current instance.

getAttribute()

getAttribute(string  $attribute_name) : string

Get the value of a the given attribute of the element.

Parameters

string $attribute_name

The name of the attribute.

Returns

string —

The value of the attribute.

getCSSValue()

getCSSValue(string  $css_property_name) : string

Get the value of a given CSS property.

Parameters

string $css_property_name

The name of the CSS property.

Returns

string —

The value of the CSS property.

getLocation()

getLocation() : \WebDriverLocation

Get the location of element relative to the top-left corner of the page.

Returns

\WebDriverLocation —

The location of the element.

getLocationOnScreenOnceScrolledIntoView()

getLocationOnScreenOnceScrolledIntoView() : \WebDriverLocation

Try scrolling the element into the view port and return the location of element relative to the top-left corner of the page afterwards.

Returns

\WebDriverLocation —

The location of the element.

getSize()

getSize() : \WebDriverDimension

Get the size of element.

Returns

\WebDriverDimension —

The dimension of the element.

getTagName()

getTagName() : string

Get the tag name of this element.

Returns

string —

The tag name.

getText()

getText() : string

Get the visible (i.e. not hidden by CSS) innerText of this element, including sub-elements, without any leading or trailing whitespace.

Returns

string —

The visible innerText of this element.

isDisplayed()

isDisplayed() : boolean

Is this element displayed or not? This method avoids the problem of having to parse an element's "style" attribute.

Returns

boolean

isEnabled()

isEnabled() : boolean

Is the element currently enabled or not? This will generally return true for everything but disabled input elements.

Returns

boolean

isSelected()

isSelected() : boolean

Determine whether or not this element is selected or not.

Returns

boolean

sendKeys()

sendKeys(mixed  $value) : \WebDriverElement

Simulate typing into an element, which may set its value.

Parameters

mixed $value

The data to be typed.

Returns

\WebDriverElement —

The current instance.

submit()

submit() : \WebDriverElement

If this current element is a form, or an element within a form, then this will be submitted to the remote server.

Returns

\WebDriverElement —

The current instance.

getID()

getID() : string

Get the opaque ID of the element.

Returns

string —

The opaque ID.