class BEMElementLocator extends DefaultElementLocator (View source)

Locates BEM blocks/elements.

Properties

protected ISearchContext $searchContext Search context. from DefaultElementLocator
protected AnnotationManager $annotationManager Annotation manager. from DefaultElementLocator
protected Property $property Property. from DefaultElementLocator
private LocatorHelper $_helper Locator helper.

Methods

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

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

array
getBlockLocator(string $block_name, string|null $modificator_name = null, string|null $modificator_value = null)

Returns block locator.

array
getElementLocator(string $element_name, string $block_name, string|null $modificator_name = null, string|null $modificator_value = null)

Returns element locator.

Details

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

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.
LocatorHelper $locator_helper Locator helper.

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

array getBlockLocator(string $block_name, string|null $modificator_name = null, string|null $modificator_value = null)

Returns block locator.

Parameters

string $block_name Block name.
string|null $modificator_name Modificator name.
string|null $modificator_value Modificator value.

Return Value

array

array getElementLocator(string $element_name, string $block_name, string|null $modificator_name = null, string|null $modificator_value = null)

Returns element locator.

Parameters

string $element_name Element name.
string $block_name Block name.
string|null $modificator_name Modificator name.
string|null $modificator_value Modificator value.

Return Value

array