Skip to main content

untilJsThrowsNoException

Waits until given js snippet stops throwing errors.

Use it if a js code when run in the browser may throw some error until some condition is met when it stops throwing further errors.

A use case is to wait for a condition repeatedly using js (such as using setInterval). Until the condition is true, an error is thrown.

untilJsThrowsNoException(snippet)

Uses Script timeout.

Parameters#

  • snippet: A js snippet as string

Returns#

  • boolean true if expectation fulfills

Example#

# focus on an element, an error will be thrown until element has appeared and is focuseduntilJsThrowsNoException("document.getElementsByName('firstName')[0].focus()")