You are here

public function VarbaseContext::matchingElementAfterWait in Varbase: The Ultimate Drupal CMS Starter Kit (Bootstrap Ready) 9.0.x

Matching element exists on the page after a wait.

Parameters

string $selector_type: The element selector type (css, xpath).

string|array $selector: The element selector.

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

2 calls to VarbaseContext::matchingElementAfterWait()
VarbaseContext::iAmloggedInUserWithTheUser in tests/features/bootstrap/VarbaseContext.php
Authenticate a user with password from varbase configuration.
VarbaseContext::iAmLoggedInUserWithTheUsernameAndPassword in tests/features/bootstrap/VarbaseContext.php
Authenticate a user with a given username and password on the spot.

File

tests/features/bootstrap/VarbaseContext.php, line 1667

Class

VarbaseContext
Defines application features from the specific context.

Code

public function matchingElementAfterWait($selector_type, $selector, $timeout = 10000) {
  $start = microtime(TRUE);
  $end = $start + $timeout / 1000;
  $page = $this
    ->getSession()
    ->getPage();
  do {
    $node = $page
      ->find($selector_type, $selector);
    if (empty($node)) {
      return FALSE;
    }
    usleep(100000);
  } while (microtime(TRUE) < $end);
  return TRUE;
}