You are here

public function JSWebAssert::waitForElementRemoved in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php \Drupal\FunctionalJavascriptTests\JSWebAssert::waitForElementRemoved()
  2. 10 core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php \Drupal\FunctionalJavascriptTests\JSWebAssert::waitForElementRemoved()

Looks for the specified selector and returns TRUE when it is unavailable.

Parameters

string $selector: The selector engine name. See ElementInterface::findAll() for the supported selectors.

string|array $locator: The selector locator.

int $timeout: (Optional) Timeout in milliseconds, defaults to 10000.

Return value

bool TRUE if not found, FALSE if found.

See also

\Behat\Mink\Element\ElementInterface::findAll()

File

core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php, line 90

Class

JSWebAssert
Defines a class with methods for asserting presence of elements during tests.

Namespace

Drupal\FunctionalJavascriptTests

Code

public function waitForElementRemoved($selector, $locator, $timeout = 10000) {
  $page = $this->session
    ->getPage();
  $result = $page
    ->waitFor($timeout / 1000, function () use ($page, $selector, $locator) {
    return !$page
      ->find($selector, $locator);
  });
  return $result;
}