public function JSWebAssert::waitForElement in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/FunctionalJavascriptTests/JSWebAssert.php \Drupal\FunctionalJavascriptTests\JSWebAssert::waitForElement()
Waits for the specified selector and returns it when available.
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
\Behat\Mink\Element\NodeElement|null The page element node if found, NULL if not.
See also
\Behat\Mink\Element\ElementInterface::findAll()
4 calls to JSWebAssert::waitForElement()
- JSWebAssert::waitForButton in core/
tests/ Drupal/ FunctionalJavascriptTests/ JSWebAssert.php - Waits for a button (input[type=submit|image|button|reset], button) with specified locator and returns it.
- JSWebAssert::waitForField in core/
tests/ Drupal/ FunctionalJavascriptTests/ JSWebAssert.php - Waits for a field with specified locator and returns it when available.
- JSWebAssert::waitForId in core/
tests/ Drupal/ FunctionalJavascriptTests/ JSWebAssert.php - Waits for an element by its id and returns it when available.
- JSWebAssert::waitForLink in core/
tests/ Drupal/ FunctionalJavascriptTests/ JSWebAssert.php - Waits for a link with specified locator and returns it when available.
File
- core/
tests/ Drupal/ FunctionalJavascriptTests/ JSWebAssert.php, line 68
Class
- JSWebAssert
- Defines a class with methods for asserting presence of elements during tests.
Namespace
Drupal\FunctionalJavascriptTestsCode
public function waitForElement($selector, $locator, $timeout = 10000) {
return $this
->waitForHelper($timeout, function (Element $page) use ($selector, $locator) {
return $page
->find($selector, $locator);
});
}