메인 컨텐츠로 건너뛰기

waitUntil

This wait command is your universal weapon if you want to wait on something. It expects a condition and waits until that condition is fulfilled with a truthy value.

정보

As opposed to other element commands WebdriverIO will not wait for the element to exist to execute this command.

A common example is to wait until a certain element contains a certain text (see example).

Usage

await $(selector).waitUntil(condition, { timeout, timeoutMsg, interval })

Parameters

NameTypeDetails
conditionFunctioncondition to wait on
options
optional
WaitUntilOptionscommand options
options.timeout
optional
Numbertime in ms (default set based on waitforTimeout config value)
options.timeoutMsg
optional
String, Functionerror message to throw when waitUntil times out. A function is evaluated only after the timeout, so the message can include state from that moment.
options.interval
optional
Numberinterval between condition checks (default set based on waitforInterval config value)

Examples

index.html
loading...
waitUntilExample.js
loading...

Returns

  • <Boolean> return: true if condition is fulfilled

Welcome! How can I help?

WebdriverIO AI Copilot