PHP Class Nearsoft\SeleniumClient\WebElement

Show file Open project: nearsoft/php-selenium-client

Public Methods

Method Description
__call ( string $name, array $args ) : mixed Enables setAttribute and getAttribute methods be invoked through method missing.
__construct ( WebDriver $driver, $elementId )
addClass ( string $class )
clear ( ) Clear current element's text
click ( ) Click on element
compareToOther ( WebElement $webElementCompare ) : boolean Test if two element refer to the same DOM element.
describe ( ) : Array Gets element's description
findElement ( By $locator, boolean $polling = false ) : Nearsoft\SeleniumClient\WebElement Find element within current element
findElements ( By $locator, boolean $polling = false ) : Nearsoft\SeleniumClient\WebElement[] Find elements within current element
getAttribute ( String $attributeName ) : String Gets element's specified attribute's value
getCSSProperty ( string $propertyName ) : String Gets element's property CSS
getCoordinates ( ) : Array Get element's coordinates
getElementId ( ) : integer Gets element's id
getElementSize ( ) : array Gets an element's size in pixels
getLocationOnScreenOnceScrolledIntoView ( ) : Array Get element's coordinates after scrolling
getTagName ( ) : String Gets element's tag name
getText ( ) : String Gets element's visible text
hasClass ( string $class )
isDisplayed ( ) : boolean Gets whether element is displayed
isEnabled ( ) : boolean Gets whether element is enabled
isSelected ( ) : boolean Gets whether element is selected
removeClass ( string $class )
sendKeys ( String $text ) Send text to element
setAttribute ( string $attributeName, string $value ) Sets element's specified attribute's value
submit ( ) Submit form from element
waitForElementUntilIsDisplayed ( integer $timeOutSeconds = 5 ) : Nearsoft\SeleniumClient\WebElement Wait for current element to be displayed
waitForElementUntilIsEnabled ( integer $timeOutSeconds = 5 ) : Nearsoft\SeleniumClient\WebElement Wait for current element to be enabled
waitForElementUntilIsPresent ( By $locator, integer $timeOutSeconds = 5 ) : mixed Wait for expected element to be present within current element
waitForElementUntilIsPresentWithSpecificText ( By $locator, String $targetText, integer $timeOutSeconds = 5 ) : Nearsoft\SeleniumClient\WebElement Wait until current element's text equals specified
waitForElementUntilTextIsChanged ( String $targetText, integer $timeOutSeconds = 5 ) : Nearsoft\SeleniumClient\WebElement Wait until current element's text has changed

Private Methods

Method Description
getCharArray ( String $text ) : array Returns array of chars from String

Method Details

__call() public method

The methods should be invoked with the format 'set/get'. Arguments should match those required by setAttribute and getAttribute methods. i.e. setClassName, getInnerHTML, getClassName
public __call ( string $name, array $args ) : mixed
$name string
$args array
return mixed

__construct() public method

public __construct ( WebDriver $driver, $elementId )
$driver WebDriver

addClass() public method

public addClass ( string $class )
$class string

clear() public method

Clear current element's text
public clear ( )

click() public method

Click on element
public click ( )

compareToOther() public method

Test if two element refer to the same DOM element.
public compareToOther ( WebElement $webElementCompare ) : boolean
$webElementCompare WebElement
return boolean

describe() public method

Gets element's description
public describe ( ) : Array
return Array

findElement() public method

Find element within current element
public findElement ( By $locator, boolean $polling = false ) : Nearsoft\SeleniumClient\WebElement
$locator By
$polling boolean
return Nearsoft\SeleniumClient\WebElement

findElements() public method

Find elements within current element
public findElements ( By $locator, boolean $polling = false ) : Nearsoft\SeleniumClient\WebElement[]
$locator By
$polling boolean
return Nearsoft\SeleniumClient\WebElement[]

getAttribute() public method

Gets element's specified attribute's value
public getAttribute ( String $attributeName ) : String
$attributeName String
return String

getCSSProperty() public method

Gets element's property CSS
public getCSSProperty ( string $propertyName ) : String
$propertyName string
return String

getCoordinates() public method

Get element's coordinates
public getCoordinates ( ) : Array
return Array

getElementId() public method

Gets element's id
public getElementId ( ) : integer
return integer

getElementSize() public method

Gets an element's size in pixels
public getElementSize ( ) : array
return array

getLocationOnScreenOnceScrolledIntoView() public method

Get element's coordinates after scrolling
public getLocationOnScreenOnceScrolledIntoView ( ) : Array
return Array

getTagName() public method

Gets element's tag name
public getTagName ( ) : String
return String

getText() public method

Gets element's visible text
public getText ( ) : String
return String

hasClass() public method

public hasClass ( string $class )
$class string

isDisplayed() public method

Gets whether element is displayed
public isDisplayed ( ) : boolean
return boolean

isEnabled() public method

Gets whether element is enabled
public isEnabled ( ) : boolean
return boolean

isSelected() public method

Gets whether element is selected
public isSelected ( ) : boolean
return boolean

removeClass() public method

public removeClass ( string $class )
$class string

sendKeys() public method

Send text to element
public sendKeys ( String $text )
$text String

setAttribute() public method

Sets element's specified attribute's value
public setAttribute ( string $attributeName, string $value )
$attributeName string The element's attribute name
$value string The value to set the attribute

submit() public method

Submit form from element
public submit ( )

waitForElementUntilIsDisplayed() public method

Wait for current element to be displayed
public waitForElementUntilIsDisplayed ( integer $timeOutSeconds = 5 ) : Nearsoft\SeleniumClient\WebElement
$timeOutSeconds integer
return Nearsoft\SeleniumClient\WebElement

waitForElementUntilIsEnabled() public method

Wait for current element to be enabled
public waitForElementUntilIsEnabled ( integer $timeOutSeconds = 5 ) : Nearsoft\SeleniumClient\WebElement
$timeOutSeconds integer
return Nearsoft\SeleniumClient\WebElement

waitForElementUntilIsPresent() public method

Wait for expected element to be present within current element
public waitForElementUntilIsPresent ( By $locator, integer $timeOutSeconds = 5 ) : mixed
$locator By
$timeOutSeconds integer
return mixed

waitForElementUntilIsPresentWithSpecificText() public method

Wait until current element's text equals specified
public waitForElementUntilIsPresentWithSpecificText ( By $locator, String $targetText, integer $timeOutSeconds = 5 ) : Nearsoft\SeleniumClient\WebElement
$locator By
$targetText String
$timeOutSeconds integer
return Nearsoft\SeleniumClient\WebElement

waitForElementUntilTextIsChanged() public method

Wait until current element's text has changed
public waitForElementUntilTextIsChanged ( String $targetText, integer $timeOutSeconds = 5 ) : Nearsoft\SeleniumClient\WebElement
$targetText String
$timeOutSeconds integer
return Nearsoft\SeleniumClient\WebElement