Skip to main content

Elements

DrevOps\BehatSteps\Steps\Web\ElementTrait - Source, Steps

Interact with HTML elements using CSS selectors and DOM attributes.

public function elementExecuteJs(string $selector, string $script)

Execute JS on an element provided by the selector

public function elementFindVisible(string $selector): ?NodeElement

Find the first visible element matching a CSS selector

public function elementGet(string $selector): NodeElement

Get the first element matching a CSS selector

public function elementGetNth(array $elements, int $index, string $subject): NodeElement

Return the element at a 1-based index or throw a clear error

public function elementGetPosition(string $selector): int

Get where an element's markup starts within the markup of the page

public function elementGetScrollIntoViewCenter(): bool

Whether to scroll elements to the center of the viewport

class FeatureContext extends WebContext {
public function elementGetScrollIntoViewCenter(): bool {
return FALSE;
}
}
public function elementGetVisible(string $selector): NodeElement

Get the first visible element matching a CSS selector

public function elementIsVisuallyVisible(string $selector, int $offset)

Check whether an element is displayed within the viewport