AbstractElementContainer
class AbstractElementContainer extends WebElement implements IElementContainer (View source)
The base class to be used for making blocks of elements.
To make a class that will represent a block of elements (e.g. web form) create a descendant of this class.
Properties
private NodeElement | $_wrappedElement | Wrapped element. | from WebElement |
private IPageFactory | $_pageFactory | Stores instance of used page factory. | from WebElement |
private Escaper | $_xpathEscaper | The XPath escaper. | from WebElement |
Methods
Creates Element instance based on existing NodeElement instance.
Finds first element with specified selector.
Finds all elements with specified selector.
Waits for an element(-s) to appear and returns it.
Returns the value of the form field or option element.
Checks whether element has attribute with specified name.
Checks whether current node is checked if it's a checkbox or radio field.
Selects specified option for select field or specified radio button in the group.
Checks whether current node is selected if it's a option field.
Checks whether element has a button (input[type=submit|image|button|reset], button) with specified locator.
Finds button (input[type=submit|image|button|reset], button) with specified locator.
Presses button (input[type=submit|image|button|reset], button) with specified locator.
Checks whether element has a field (input, textarea, select) with specified locator.
Finds field (input, textarea, select) with specified locator.
Fills in field (input, textarea, select) with specified locator.
Checks whether element has a checkbox with specified locator, which is checked.
Checks whether element has a checkbox with specified locator, which is unchecked.
Checks whether element has a select field with specified locator.
Selects option from select field with specified locator.
Checks whether element has a table with specified locator.
Attach file to file field with specified locator.
Checks whether element with specified selector exists inside the current element.
Details
at line 33
__construct(NodeElement $wrapped_element, IPageFactory $page_factory)
Initializes html element.
at line 49
static INodeElementAware
fromNodeElement(NodeElement $node_element, IPageFactory $page_factory)
Creates Element instance based on existing NodeElement instance.
in WebElement at line 137
NodeElement|null
find(string $selector, string|array $locator)
Finds first element with specified selector.
in WebElement at line 150
NodeElement[]
findAll(string $selector, string|array $locator)
Finds all elements with specified selector.
in WebElement at line 164
mixed
waitFor(integer $timeout, callable $callback)
Waits for an element(-s) to appear and returns it.
in WebElement at line 178
mixed
__call(string $method, array $arguments)
Proxies all methods to sub-object.
in WebElement at line 194
Escaper
getXpathEscaper()
Returns the XPath escaper.
in WebElement at line 205
Session
getSession()
deprecated
deprecated
Returns element session.
in WebElement at line 220
protected IPageFactory
getPageFactory()
Returns page factory, used during object creation.
in WebElement at line 230
string
__toString()
Returns string representation of element.
in WebElement at line 79
Expectation
shouldReceive(string $name)
in WebElement at line 79
string
getXpath()
Returns XPath for handled element.
in WebElement at line 79
NodeElement
getParent()
Returns parent element to the current one.
in WebElement at line 79
string
getTagName()
Returns current node tag name.
in WebElement at line 79
string|boolean|array
getValue()
Returns the value of the form field or option element.
in WebElement at line 79
void
setValue($value)
Sets the value of the form field.
in WebElement at line 79
boolean
hasAttribute($name)
Checks whether element has attribute with specified name.
in WebElement at line 79
string|null
getAttribute($name)
Returns specified attribute value.
in WebElement at line 79
boolean
hasClass($className)
Checks whether an element has a named CSS class.
in WebElement at line 79
void
click()
Clicks current node.
in WebElement at line 79
void
press()
Presses current button.
in WebElement at line 79
void
doubleClick()
Double-clicks current node.
in WebElement at line 79
void
rightClick()
Right-clicks current node.
in WebElement at line 79
void
check()
Checks current node if it's a checkbox field.
in WebElement at line 79
void
uncheck()
Unchecks current node if it's a checkbox field.
in WebElement at line 79
boolean
isChecked()
Checks whether current node is checked if it's a checkbox or radio field.
in WebElement at line 79
void
selectOption($option, $multiple = false)
Selects specified option for select field or specified radio button in the group.
in WebElement at line 79
boolean
isSelected()
Checks whether current node is selected if it's a option field.
in WebElement at line 79
void
attachFile($path)
Attach file to current node if it's a file input.
in WebElement at line 79
boolean
isVisible()
Checks whether current node is visible on page.
in WebElement at line 79
void
mouseOver()
Simulates a mouse over on the element.
in WebElement at line 79
void
dragTo(ElementInterface $destination)
Drags current node onto other node.
in WebElement at line 79
void
focus()
Brings focus to element.
in WebElement at line 79
void
blur()
Removes focus from element.
in WebElement at line 79
void
keyPress($char, $modifier = null)
Presses specific keyboard key.
in WebElement at line 79
void
keyDown($char, $modifier = null)
Pressed down specific keyboard key.
in WebElement at line 79
void
keyUp($char, $modifier = null)
Pressed up specific keyboard key.
in WebElement at line 79
void
submit()
Submits the form.
in WebElement at line 79
NodeElement|null
findById($id)
Finds element by its id.
in WebElement at line 79
boolean
hasLink($locator)
Checks whether element has a link with specified locator.
in WebElement at line 79
NodeElement|null
findLink($locator)
Finds link with specified locator.
in WebElement at line 79
void
clickLink($locator)
Clicks link with specified locator.
in WebElement at line 79
boolean
hasButton($locator)
Checks whether element has a button (input[type=submit|image|button|reset], button) with specified locator.
in WebElement at line 79
NodeElement|null
findButton($locator)
Finds button (input[type=submit|image|button|reset], button) with specified locator.
in WebElement at line 79
void
pressButton($locator)
Presses button (input[type=submit|image|button|reset], button) with specified locator.
in WebElement at line 79
boolean
hasField($locator)
Checks whether element has a field (input, textarea, select) with specified locator.
in WebElement at line 79
NodeElement|null
findField($locator)
Finds field (input, textarea, select) with specified locator.
in WebElement at line 79
void
fillField($locator, $value)
Fills in field (input, textarea, select) with specified locator.
in WebElement at line 79
boolean
hasCheckedField($locator)
Checks whether element has a checkbox with specified locator, which is checked.
in WebElement at line 79
boolean
hasUncheckedField($locator)
Checks whether element has a checkbox with specified locator, which is unchecked.
in WebElement at line 79
void
checkField($locator)
Checks checkbox with specified locator.
in WebElement at line 79
void
uncheckField($locator)
Unchecks checkbox with specified locator.
in WebElement at line 79
boolean
hasSelect($locator)
Checks whether element has a select field with specified locator.
in WebElement at line 79
void
selectFieldOption($locator, $value, $multiple = false)
Selects option from select field with specified locator.
in WebElement at line 79
boolean
hasTable($locator)
Checks whether element has a table with specified locator.
in WebElement at line 79
void
attachFileToField($locator, $path)
Attach file to file field with specified locator.
in WebElement at line 79
boolean
has($selector, $locator)
Checks whether element with specified selector exists inside the current element.
in WebElement at line 79
boolean
isValid()
Checks if an element still exists in the DOM.
in WebElement at line 79
string
getText()
Returns element text (inside tag).
in WebElement at line 79
string
getHtml()
Returns element inner html.
in WebElement at line 79
string
getOuterHtml()
Returns element outer html.