You are here

protected function AwaitTrait::awaitElement in Lightning Core 8.3

Same name and namespace in other branches
  1. 8.5 tests/contexts/AwaitTrait.inc \Acquia\LightningExtension\Context\AwaitTrait::awaitElement()
  2. 8 tests/contexts/AwaitTrait.inc \Acquia\LightningExtension\Context\AwaitTrait::awaitElement()
  3. 8.2 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 45

Class

AwaitTrait
@internal This is an internal part of Lightning Core's testing system and may be changed or removed at any time without warning. It should not be extended, instantiated, or used in any way by external code! If you need to use this functionality,…

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);
}