class WebElementCollectionProxy extends WebElementProxy (View source)

Class for lazy-proxy creation to ensure, that WebElementCollection are really accessed only at moment, when user needs them.

Properties

protected string $elementClass Element class, that is allowed in the collection. from AbstractElementCollection
protected string $className Class name to proxy. from AbstractProxy
protected mixed $object Object to proxy. from AbstractProxy
protected IElementLocator $locator Locator, that can be used to find associated elements on a page. from AbstractProxy
protected boolean $locatorUsed Determines if a locator was used to locate the elements. from AbstractProxy
protected IPageFactory $pageFactory Page Factory, that allows to create more elements on demand. from AbstractProxy

Methods

__construct(IElementLocator $locator, IPageFactory $page_factory)

Initializes proxy for WebElementCollection.

boolean
acceptElement(mixed $element)

Determines if an element can be added to a collection.

void
offsetSet(mixed $index, mixed $newval)

Offset to set.

fromNodeElements(array $node_elements, string $element_class = null, IPageFactory $page_factory)

Creates new collection by wrapping given array of Node elements.

boolean
isNodeElementAware(string $class_name)

Determines if class is NodeElement aware.

boolean
assertElement(mixed $element)

Checks that element's class is allowed in collection.

Expectation
shouldReceive(string $name)

No description

setClassName(string $class_name)

Sets class name, used inside the proxy.

mixed
__get(string $property)

Proxies read access for properties to the sub-object.

void
__set(string $property, mixed $value)

Proxies write access for properties to the sub-object.

mixed
__call(string $method, array $arguments)

Proxies all methods to sub-object.

NodeElement
locateElement()

Locates element using the locator.

NodeElement[]
locateElements()

Locates elements using the locator.

boolean
offsetExists(mixed $index)

Whether an offset exists.

void
offsetUnset(mixed $index)

Offset to unset.

mixed|null
offsetGet(mixed $index)

Offset to retrieve.

integer
count()

Count elements of an object.

getIterator()

Returns the array iterator.

mixed
locateObject()

Locates object inside proxy.

mixed
getObject()

Returns class instance, that was placed inside a proxy.

Details

__construct(IElementLocator $locator, IPageFactory $page_factory)

Initializes proxy for WebElementCollection.

Parameters

IElementLocator $locator Element selector.
IPageFactory $page_factory Page factory.

protected boolean acceptElement(mixed $element)

Determines if an element can be added to a collection.

Parameters

mixed $element Element.

Return Value

boolean

void offsetSet(mixed $index, mixed $newval)

Offset to set.

Parameters

mixed $index The offset to assign the value to.
mixed $newval The value to set.

Return Value

void

static AbstractElementCollection fromNodeElements(array $node_elements, string $element_class = null, IPageFactory $page_factory)

Creates new collection by wrapping given array of Node elements.

Parameters

array $node_elements Node elements to wrap.
string $element_class Class name to wrap Node elements with.
IPageFactory $page_factory Page factory (optional) to use during wrapping.

Return Value

AbstractElementCollection

Exceptions

ElementCollectionException When element class used doesn't allow adding NodeElements inside.

protected boolean isNodeElementAware(string $class_name)

Determines if class is NodeElement aware.

Parameters

string $class_name Class name.

Return Value

boolean

protected boolean assertElement(mixed $element)

Checks that element's class is allowed in collection.

Parameters

mixed $element Element.

Return Value

boolean

Exceptions

ElementCollectionException When class of given element doesn't match one, that collection accepts.

Expectation shouldReceive(string $name)

Parameters

string $name

Return Value

Expectation

IProxy setClassName(string $class_name)

Sets class name, used inside the proxy.

Parameters

string $class_name Class name to proxy.

Return Value

IProxy

mixed __get(string $property)

Proxies read access for properties to the sub-object.

Parameters

string $property Property to proxy.

Return Value

mixed

Exceptions

ElementException When sub-object doesn't have a specific property.

void __set(string $property, mixed $value)

Proxies write access for properties to the sub-object.

Parameters

string $property Property to proxy.
mixed $value Property value.

Return Value

void

Exceptions

ElementException When sub-object doesn't have a specific property.

mixed __call(string $method, array $arguments)

Proxies all methods to sub-object.

Parameters

string $method Method to proxy.
array $arguments Method arguments.

Return Value

mixed

Exceptions

ElementException When sub-object doesn't have a specified method.

protected NodeElement locateElement()

Locates element using the locator.

Return Value

NodeElement

protected NodeElement[] locateElements()

Locates elements using the locator.

Return Value

NodeElement[]

Exceptions

ElementNotFoundException When element wasn't found on the page.

boolean offsetExists(mixed $index)

Whether an offset exists.

Parameters

mixed $index An offset to check for.

Return Value

boolean

void offsetUnset(mixed $index)

Offset to unset.

Parameters

mixed $index The offset to unset.

Return Value

void

mixed|null offsetGet(mixed $index)

Offset to retrieve.

Parameters

mixed $index The offset to retrieve.

Return Value

mixed|null

integer count()

Count elements of an object.

Return Value

integer

ArrayIterator getIterator()

Returns the array iterator.

Return Value

ArrayIterator

protected mixed locateObject()

Locates object inside proxy.

Return Value

mixed

mixed getObject()

Returns class instance, that was placed inside a proxy.

Return Value

mixed