Skip to main content
Use readQRCode(page, selector) when the QR code is rendered in the browser.
import { readQRCode } from "@qawolf/testkit/web";

const value = await readQRCode(page, "[data-testid='qr-code']");

if (!value) throw new Error("QR code was not found");
The helper screenshots the matching locator, decodes the PNG bytes, and returns the QR code value.
const loginUrl = await readQRCode(page, ".login-qr-code");

if (!loginUrl) throw new Error("Login QR code did not render");

await page.goto(loginUrl);
Use a selector that points directly at the QR code image or canvas. Avoid capturing large containers with surrounding UI. For the exact return value, see the Web Reference.
Last modified on April 24, 2026