Common scenarios
Patterns for lazy-loaded pages, CAPTCHA, payments, two-factor sign-in, unique data and API setup.
Lazy-loaded content
Some pages load content only when it scrolls into view. Scroll with an Execute Javascript step, then wait for the content with Wait for element present.
window.scrollTo(0, document.body.scrollHeight);CAPTCHA
Testinspector.AI does not solve CAPTCHAs. On your test environment, configure the CAPTCHA provider's test keys, which always pass, or turn the CAPTCHA off for test accounts. Run tests against that environment, not production.
Payments
Use your payment provider's test mode on your test environment. For example, Stripe's test card 4242 4242 4242 4242 with any future expiry date and any CVC is accepted without a real charge.
Steps act on the main page only, so card fields inside an embedded payment frame cannot be reached by selector. Test the flow through a hosted checkout page, or create the payment with a request step against your test backend.
Sign-in with two-factor codes
Type {{TOTP:secret}} in an Assign step, where secret is the base32 key from the authenticator setup. A current six-digit code is generated when the step runs.
Write the key directly in the token. A variable inside the token, such as {{TOTP:{{SECRET}}}}, is not resolved.
{ "command": "assign", "target": "#otp", "value": "{{TOTP:JBSWY3DPEHPK3PXP}}" }Unique data
Use built-in values so each run creates new records:
- {{TIMESTAMP}}: the current time in milliseconds, for example qa+{{TIMESTAMP}}@example.com
- {{ALPHANUMERIC}}: a random 16-character string of lowercase letters and digits
Reusing a unique value
Each step field gets its own value, so {{ALPHANUMERIC}} in two steps produces two different strings. To use the same value twice, save it once with Set variable and reference the variable in later steps.
{ "command": "store", "variable_name": "USERNAME", "value": "user-{{ALPHANUMERIC}}" }
{ "command": "assign", "target": "#username", "value": "{{USERNAME}}" }API setup, then UI checks
Use request steps to create or reset data before the browser steps check it. Request steps run outside the browser page, so they do not share its cookies or sign-in state.
Each request step checks the response status or body. Variables are resolved in the URL and the expected value. Headers and body are sent as written, and the response cannot be saved to a variable.
- POST to your test API to create a record, expecting status 201
- Go to URL for the page that lists the record
- Element text contain to confirm the record is shown