class AbstractElementContainer extends AbstractTypifiedElement implements IElementContainer (View source)

The base class to be used for making blocks of elements on top of a typified element.

To make a class that will represent a block of elements (e.g. web form) create a descendant of this class.

Constants

CRITERION_TAG

CRITERION_ATTRS

Properties

private string $_name Name of the element. from AbstractTypifiedElement
private WebElement $_wrappedElement Wrapped element. from AbstractTypifiedElement
private IPageFactory $_pageFactory Stores instance of used page factory. from AbstractTypifiedElement
protected array $acceptanceCriteria List of acceptance criteria. from AbstractTypifiedElement

Methods

__construct(WebElement $wrapped_element, IPageFactory $page_factory)

Specifies wrapped WebElement.

fromNodeElement(NodeElement $node_element, IPageFactory $page_factory)

Creates Element instance based on existing NodeElement instance.

void
assertWrappedElement()

Checks that wrapped element meets the acceptance criteria.

boolean
isTagNameMatching(array $criterion)

Checks if the tag name(s) of the criterion are matching.

boolean
isAttributeMatching(array $criterion)

Checks if the attributes of the criterion are matching.

boolean
isValueMatchingCriterionDefinition(string $value, string $criterion)

Checks if passed value matching the defined criterion.

getWrappedElement()

Returns wrapped element.

setName(string $name)

Sets a name of an element.

string
getName()

Returns name of the entity.

Session
getSession() deprecated

Returns element session.

getPageFactory()

Returns page factory, used during object creation.

boolean
isVisible()

Checks whether current node is visible on page.

boolean
isValid()

Checks if an element is still valid.

boolean
hasAttribute(string $name)

Checks whether element has attribute with specified name.

mixed|null
getAttribute(string $name)

Returns specified attribute value.

string
getXpath()

Returns XPath for handled element.

string
getTagName()

Returns current node tag name.

Escaper
getXpathEscaper()

Returns the XPath escaper.

boolean
isSeleniumDriver()

Checks, that Selenium driver is used.

string
__toString()

Returns string representation of element.

Expectation
shouldReceive(string $name)

No description

NodeElement[]
findAll(string $selector, string|array $locator)

Finds all elements with specified selector.

NodeElement|null
find(string $selector, string|array $locator)

Finds first element with specified selector.

mixed
waitFor(integer $timeout, callable $callback)

Waits for an element(-s) to appear and returns it.

Details

__construct(WebElement $wrapped_element, IPageFactory $page_factory)

Specifies wrapped WebElement.

Parameters

WebElement $wrapped_element Element to be wrapped.
IPageFactory $page_factory Page factory.

static INodeElementAware fromNodeElement(NodeElement $node_element, IPageFactory $page_factory)

Creates Element instance based on existing NodeElement instance.

Parameters

NodeElement $node_element Node element.
IPageFactory $page_factory Page factory.

Return Value

INodeElementAware

protected void assertWrappedElement()

Checks that wrapped element meets the acceptance criteria.

Return Value

void

Exceptions

TypifiedElementException When no criteria matches.

protected boolean isTagNameMatching(array $criterion)

Checks if the tag name(s) of the criterion are matching.

Parameters

array $criterion The criterion.

Return Value

boolean

protected boolean isAttributeMatching(array $criterion)

Checks if the attributes of the criterion are matching.

Parameters

array $criterion The criterion.

Return Value

boolean

protected boolean isValueMatchingCriterionDefinition(string $value, string $criterion)

Checks if passed value matching the defined criterion.

Parameters

string $value Value to match.
string $criterion The criterion.

Return Value

boolean

WebElement getWrappedElement()

Returns wrapped element.

Return Value

WebElement

ITypifiedElement setName(string $name)

Sets a name of an element.

This method is used by initialization mechanism and is not intended to be used directly.

Parameters

string $name Name to set.

Return Value

ITypifiedElement

string getName()

Returns name of the entity.

Return Value

string

Session getSession() deprecated

deprecated Accessing the session from the element is deprecated as of 1.2 and will be impossible in 2.0.

Returns element session.

Return Value

Session

protected IPageFactory getPageFactory()

Returns page factory, used during object creation.

Return Value

IPageFactory

boolean isVisible()

Checks whether current node is visible on page.

Return Value

boolean

boolean isValid()

Checks if an element is still valid.

Return Value

boolean

boolean hasAttribute(string $name)

Checks whether element has attribute with specified name.

Parameters

string $name Attribute name.

Return Value

boolean

mixed|null getAttribute(string $name)

Returns specified attribute value.

Parameters

string $name Attribute name.

Return Value

mixed|null

string getXpath()

Returns XPath for handled element.

Return Value

string

string getTagName()

Returns current node tag name.

Return Value

string

Escaper getXpathEscaper()

Returns the XPath escaper.

Return Value

Escaper

protected boolean isSeleniumDriver()

Checks, that Selenium driver is used.

Return Value

boolean

string __toString()

Returns string representation of element.

Return Value

string

Expectation shouldReceive(string $name)

Parameters

string $name

Return Value

Expectation

NodeElement[] findAll(string $selector, string|array $locator)

Finds all elements with specified selector.

Parameters

string $selector Selector engine name.
string|array $locator Selector locator.

Return Value

NodeElement[]

NodeElement|null find(string $selector, string|array $locator)

Finds first element with specified selector.

Parameters

string $selector Selector engine name.
string|array $locator Selector locator.

Return Value

NodeElement|null

mixed waitFor(integer $timeout, callable $callback)

Waits for an element(-s) to appear and returns it.

Parameters

integer $timeout Maximal allowed waiting time in seconds.
callable $callback Callback, which result is both used as waiting condition and returned. Will receive reference to this element as first argument.

Return Value

mixed