Skip to main content
app.webview() reaches the elements of a page shown in a WebView: react-native-webview on iOS and Android, an <iframe> on the web. react-native-webview has no web implementation, so an app renders an iframe there itself, e.g. in a MyWebView.web.tsx.
  • Every call waits for the app to be idle and for the page to settle: loaded, and no fetch / XMLHttpRequest of the page running (counted by a script Quiesco adds to the page). The page’s timers are not tracked; assertions retry until their timeout anyway.
  • Only the WebView’s main frame: iframes inside the page and shadow DOM are not reached.
  • iOS and Android need @quiesco/native: scripts run through the native WebView, so the app needs no onMessage. Without it, calls fail with ACTION_NOT_SUPPORTED.
Every method takes the timeoutMs and sync call options as its last argument.

Finding the page and its elements

webview(target?)

Types: MatcherInput · WebView The WebView matching target, any matcher such as its testID. Without an argument, the only WebView on screen.

element(query)

Types: WebElementQuery · WebElement An element of the page. query has exactly one of css, xpath, id or text, and optionally an index when several elements match.

Acting on elements

tap(options?)

Types: CallOptions · PageElement A real tap, after scrolling the element into view: on iOS and Android a touch at the element’s position on the screen, on the web Playwright input.
It fails at once with MULTIPLE_MATCHES when several elements match, and with ELEMENT_NOT_FOUND when no visible, enabled match appears within the timeout.

type(text, options?)

Types: CallOptions · PageElement Taps the field, so it gets the focus as from a user, then inserts text at the caret (execCommand('insertText'), which fires input events like typing). There is no software keyboard input.

replaceText(text, options?)

Types: CallOptions · PageElement Taps the field, then replaces its whole value with text.

scrollIntoView(options?)

Types: CallOptions · PageElement Scrolls the page until the element is in view.

screenshot(options?)

Types: CallOptions A PNG of the element, scrolled into view first: the part inside the WebView’s visible area. More on screenshots.

Assertions

Like the app’s own assertions, these retry until they hold or the call’s timeout runs out.

expectText(text, options?)

Types: TextQuery · CallOptions · PageElement The single match’s text equals text (whitespace collapsed), or matches a RegExp. For an input field, its value.

expectExists(options?)

Types: CallOptions · PageElement At least one element matches, visible or not.

expectNotExists(options?)

Types: CallOptions No element matches.

expectVisible(options?)

Types: CallOptions · PageElement A match is visible: in the page’s viewport (not scrolled away) and not hidden by CSS.

expectNotVisible(options?)

Types: CallOptions No match is visible: each one is scrolled away, hidden by CSS, or missing.

The page

runScript(body, args?, options?)

Types: JsonValue · CallOptions Runs a function body in the page and returns its value, as JSON. args are passed as arguments; a returned promise is awaited.
An exception in the page fails the call with APP_ERROR. runScript uses new Function, which a page’s Content-Security-Policy may forbid.

url(options?)

Types: CallOptions The page’s URL, location.href.

title(options?)

Types: CallOptions The page’s title, document.title.