You are here

protected function AwaitTrait::awaitElement in Lightning Core 8

Same name and namespace in other branches
  1. 8.5 tests/contexts/AwaitTrait.inc \Acquia\LightningExtension\Context\AwaitTrait::awaitElement()
  2. 8.2 tests/contexts/AwaitTrait.inc \Acquia\LightningExtension\Context\AwaitTrait::awaitElement()
  3. 8.3 tests/contexts/AwaitTrait.inc \Acquia\LightningExtension\Context\AwaitTrait::awaitElement()
  4. 8.4 tests/contexts/AwaitTrait.inc \Acquia\LightningExtension\Context\AwaitTrait::awaitElement()

Waits for an element to exist.

Parameters

string $selector: The element's CSS selector.

int $timeout: (optional) How long, in seconds, to wait before timing out.

Return value

\Behat\Mink\Element\NodeElement The awaited element.

File

tests/contexts/AwaitTrait.inc, line 38

Class

AwaitTrait

Namespace

Acquia\LightningExtension\Context

Code

protected function awaitElement($selector, $timeout = 10) {
  $js = 'document.querySelector("' . addslashes($selector) . '")';
  $this
    ->awaitExpression($js, $timeout);
  return $this
    ->assertSession()
    ->elementExists('css', $selector);
}