The device is the core component that allows you to interact with the mobile app. It provides methods for interacting with the app, such as tapping, typing, and verifying the state of elements etc.
API reference for Device
Locators are essential for selecting elements in the app. Appwright provides a set of built-in locators that you can use to select elements by text, ID, RegExp or XPath.
API reference for Locator
The webView fixture provides methods for interacting with WebView content in hybrid mobile applications. It automatically handles context switching between native and web contexts.
webView.getByTestId(testId)- Select by data-testid attribute (recommended for WebView elements)webView.getByText(text, options?)- Select by visible text contentwebView.css(selector)- Select by CSS selectorwebView.getByXpath(xpath)- Select by XPath expressionwebView.getByPlaceholder(text)- Select input by placeholder textwebView.evaluate(script)- Execute JavaScript in WebView context
test('WebView test', async ({ webView }) => {
await webView.getByTestId('username').fill('admin');
await webView.getByText('Login').tap();
await expect(webView.getByText('Welcome')).toBeVisible();
});Currently supports apps with a single WebView only. The framework automatically connects to the first available WebView context within your app.