HumHub Documentation (unofficial)

RemoteWebElement
in package
implements WebDriverElement, WebDriverLocatable

Represents an HTML element.

Table of Contents

Interfaces

WebDriverElement
Interface for an HTML element in the WebDriver framework.
WebDriverLocatable
Interface representing basic mouse operations.

Properties

$executor  : RemoteExecuteMethod
$fileDetector  : FileDetector
$id  : string
$isW3cCompliant  : bool

Methods

__construct()  : mixed
clear()  : RemoteWebElement
Clear content editable or resettable element
click()  : RemoteWebElement
Click this element.
equals()  : bool
Test if two elements IDs refer to the same DOM element.
findElement()  : RemoteWebElement
Find the first WebDriverElement within this element using the given mechanism.
findElements()  : array<string|int, RemoteWebElement>
Find all WebDriverElements within this element using the given mechanism.
getAttribute()  : string|true|null
Get the value of the given attribute of the element.
getCoordinates()  : WebDriverCoordinates
getCSSValue()  : string
Get the value of a given CSS property.
getDomProperty()  : mixed|null
Gets the value of a IDL JavaScript property of this element (for example `innerHTML`, `tagName` etc.).
getID()  : string
Get the opaque ID of the element.
getLocation()  : WebDriverPoint
Get the location of element relative to the top-left corner of the page.
getLocationOnScreenOnceScrolledIntoView()  : WebDriverPoint
Try scrolling the element into the view port and return the location of element relative to the top-left corner of the page afterwards.
getShadowRoot()  : ShadowRoot
Get representation of an element's shadow root for accessing the shadow DOM of a web component.
getSize()  : WebDriverDimension
Get the size of element.
getTagName()  : string
Get the (lowercase) tag name of this element.
getText()  : string
Get the visible (i.e. not hidden by CSS) innerText of this element, including sub-elements, without any leading or trailing whitespace.
isDisplayed()  : bool
Is this element displayed or not? This method avoids the problem of having to parse an element's "style" attribute.
isEnabled()  : bool
Is the element currently enabled or not? This will generally return true for everything but disabled input elements.
isSelected()  : bool
Determine whether this element is selected or not.
sendKeys()  : RemoteWebElement
Simulate typing into an element, which may set its value.
setFileDetector()  : RemoteWebElement
Set the fileDetector in order to let the RemoteWebElement to know that you are going to upload a file.
submit()  : RemoteWebElement
If this current element is a form, or an element within a form, then this will be submitted to the remote server.
takeElementScreenshot()  : string
Take a screenshot of a specific element.
clickChildElement()  : mixed
Attempt to click on a child level element.
createTemporaryZipArchive()  : string
newElement()  : static
Return the WebDriverElement with $id
upload()  : string
Upload a local file to the server

Properties

Methods

findElement()

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

public findElement(WebDriverBy $by) : RemoteWebElement

When using xpath be aware that webdriver follows standard conventions: a search prefixed with "//" will search the entire document from the root, not just the children (relative context) of this current node. Use ".//" to limit your search to the children of this element.

Parameters
$by : WebDriverBy
Tags
see
WebDriverBy
Return values
RemoteWebElement

NoSuchElementException is thrown in HttpCommandExecutor if no element is found.

findElements()

Find all WebDriverElements within this element using the given mechanism.

public findElements(WebDriverBy $by) : array<string|int, RemoteWebElement>

When using xpath be aware that webdriver follows standard conventions: a search prefixed with "//" will search the entire document from the root, not just the children (relative context) of this current node. Use ".//" to limit your search to the children of this element.

Parameters
$by : WebDriverBy
Tags
see
WebDriverBy
Return values
array<string|int, RemoteWebElement>

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

getAttribute()

Get the value of the given attribute of the element.

public getAttribute(string $attribute_name) : string|true|null

Attribute is meant what is declared in the HTML markup of the element. To read a value of a IDL "JavaScript" property (like innerHTML), use getDomProperty() method.

Parameters
$attribute_name : string

The name of the attribute.

Return values
string|true|null

The value of the attribute. If this is boolean attribute, return true if the element has it, otherwise return null.

getCSSValue()

Get the value of a given CSS property.

public getCSSValue(string $css_property_name) : string
Parameters
$css_property_name : string

The name of the CSS property.

Return values
string

The value of the CSS property.

getID()

Get the opaque ID of the element.

public getID() : string
Return values
string

The opaque ID.

getLocationOnScreenOnceScrolledIntoView()

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

public getLocationOnScreenOnceScrolledIntoView() : WebDriverPoint
Return values
WebDriverPoint

The location of the element.

getShadowRoot()

Get representation of an element's shadow root for accessing the shadow DOM of a web component.

public getShadowRoot() : ShadowRoot
Return values
ShadowRoot

getTagName()

Get the (lowercase) tag name of this element.

public getTagName() : string
Return values
string

The tag name.

getText()

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

public getText() : string
Return values
string

The visible innerText of this element.

isDisplayed()

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

public isDisplayed() : bool
Return values
bool

isEnabled()

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

public isEnabled() : bool
Return values
bool

isSelected()

Determine whether this element is selected or not.

public isSelected() : bool
Return values
bool

setFileDetector()

Set the fileDetector in order to let the RemoteWebElement to know that you are going to upload a file.

public setFileDetector(FileDetector $detector) : RemoteWebElement

Basically, if you want WebDriver trying to send a file, set the fileDetector to be LocalFileDetector. Otherwise, keep it UselessFileDetector.

eg. $element->setFileDetector(new LocalFileDetector);

Parameters
$detector : FileDetector
Tags
see
FileDetector
see
LocalFileDetector
see
UselessFileDetector
Return values
RemoteWebElement

takeElementScreenshot()

Take a screenshot of a specific element.

public takeElementScreenshot([string $save_as = null ]) : string
Parameters
$save_as : string = null

The path of the screenshot to be saved.

Return values
string

The screenshot in PNG format.

clickChildElement()

Attempt to click on a child level element.

protected clickChildElement(ElementNotInteractableException $originalException) : mixed

This provides a workaround for geckodriver bug 653 whereby a link whose first element is a block-level element throws an ElementNotInteractableException could not scroll into view exception.

The workaround provided here attempts to click on a child node of the element. In case the first child is hidden, other elements are processed until we run out of elements.

Parameters
$originalException : ElementNotInteractableException

The exception to throw if unable to click on any child

Tags
see
https://github.com/mozilla/geckodriver/issues/653
see
https://bugzilla.mozilla.org/show_bug.cgi?id=1374283

createTemporaryZipArchive()

protected createTemporaryZipArchive(string $fileToZip) : string
Parameters
$fileToZip : string
Return values
string

newElement()

Return the WebDriverElement with $id

protected newElement(string $id) : static
Parameters
$id : string
Return values
static

upload()

Upload a local file to the server

protected upload(string $local_file) : string
Parameters
$local_file : string
Tags
throws
LogicException
Return values
string

The remote path of the file.


        
On this page

Search results