class DefaultElementLocator implements IElementLocator (View source)

Class, that locates WebElements.

Properties

protected ISearchContext $searchContext Search context.
protected AnnotationManager $annotationManager Annotation manager.
protected Property $property Property.

Methods

__construct(Property $property, ISearchContext $search_context, AnnotationManager $annotation_manager)

Creates a new element locator.

getSearchContext()

Returns search context in use.

NodeElement|null
find()

Find the element.

NodeElement[]
findAll()

Find the element list.

array
getSelectors()

Returns final selectors to be used for element locating.

void
assertAnnotationClass(array $annotations)

Asserts that required annotations are present.

string
__toString()

Returns string representation of a locator.

Expectation
shouldReceive(string $name)

No description

Details

__construct(Property $property, ISearchContext $search_context, AnnotationManager $annotation_manager)

Creates a new element locator.

Parameters

Property $property Property.
ISearchContext $search_context The context to use when finding the element.
AnnotationManager $annotation_manager Annotation manager.

ISearchContext getSearchContext()

Returns search context in use.

Return Value

ISearchContext

NodeElement|null find()

Find the element.

Return Value

NodeElement|null

NodeElement[] findAll()

Find the element list.

Return Value

NodeElement[]

Exceptions

ElementException In case no array/collection given and multiple elements found.

protected array getSelectors()

Returns final selectors to be used for element locating.

Return Value

array

protected void assertAnnotationClass(array $annotations)

Asserts that required annotations are present.

Parameters

array $annotations Annotations to test.

Return Value

void

Exceptions

AnnotationException Thrown if none or wrong annotations given.

string __toString()

Returns string representation of a locator.

Return Value

string

Expectation shouldReceive(string $name)

Parameters

string $name

Return Value

Expectation