hubcap waitrequest

Wait for a network request matching a URL pattern.

When to use

Use waitrequest to block until a network request matching a URL pattern is detected. Use waitresponse to wait for the response instead.

Usage

hubcap waitrequest <pattern> [--timeout <duration>]

Arguments

ArgumentTypeRequiredDescription
patternstringYesURL pattern to match against requests

Flags

FlagTypeDefaultDescription
—timeoutduration30sMaximum wait time

Output

FieldTypeDescription
foundboolWhether a matching request was detected
urlstringThe full URL of the matched request
methodstringHTTP method of the request
requestIdstringProtocol request identifier
{"found":true,"url":"https://api.example.com/users","method":"GET","requestId":"1234.5"}

Errors

ConditionExit codeStderr
Missing pattern argument1usage: hubcap waitrequest <pattern> [--timeout <duration>]
Chrome not connected2error: connecting to Chrome: ...
No matching request within timeout3error: timeout

Examples

Wait for an API call:

hubcap waitrequest '/api/users'

Wait for a POST request with a timeout:

hubcap waitrequest '/api/submit' --timeout 10s

Click a button and wait for the resulting API call (chaining):

hubcap click '#load-more' && hubcap waitrequest '/api/items'

See also

  • waitresponse - Wait for a network response matching a URL pattern
  • network - Monitor network activity
  • intercept - Intercept and modify network requests