waitForElement abstract method

FutureOr<void> waitForElement(
  1. String selector, {
  2. Duration? timeout,
})

Waits for an element to appear in the DOM.

selector is the CSS selector for the element to wait for. timeout is the maximum time to wait (defaults to browser config timeout).

Example:

await browser.waitForElement('.loading-spinner');
await browser.waitForElement('#success-message', timeout: Duration(seconds: 5));

Implementation

FutureOr<void> waitForElement(String selector, {Duration? timeout});