Settings usage in webcapture script
Settings defined in the settings array on a webcapture integration, are converted to variables, that can then be used in the script functions.
Example: "username" setting is converted to "$username" which can then be used in place of static values in the script functions.
There are also some reserved settings variables, that changes how the screenshot is taken:
- "screenshot_element": takes a screenshot of a specific element selector, so the screenshot taken, can be in a different size than defined in setup.viewport.
- "screenshot_x*": defines the x coordinate in pixels for the top left corner of the screenshot, this value is relative to viewport, and not the actual size of the loaded page.
- "screenshot_y*": defines the y coordinate in pixels for the top left corner of the screenshot, this value is relative to viewport, and not the actual size of the loaded page.
- "screenshot_w*": defines the screenshot width in pixels.
- "screenshot_h*": defines the screenshot height in pixels.
* Are only used if all are specified.
Script Functions
waitForSelector
Description: Waits for a specific DOM element to appear on the page before proceeding.
Usage: { "waitForSelector": ["selector", { "timeout": <timeoutInMilliseconds> }] }
Example: { "waitForSelector": ["#button-submit", { "timeout": 10000 }] }
waitForNetworkIdle
Description: Pauses execution until the network activity reduces to a specified level, useful for ensuring page loads completely.
Usage: { "waitForNetworkIdle": [ { "concurrency": <number of concurrent request that are allowed to consider network idle>, "idleTime": <number of milliseconds the network must be idle in before continuing> } ] }
Example: { "waitForNetworkIdle": ["#button-submit", { "concurrency": 2, "idleTime": 500 } ] }
sleep
Description: Pauses the script for a given duration (milliseconds).
Usage: { "sleep": [<timeoutInMilliseconds>] }
Example: { "sleep": [5000] } (waits for 5 seconds)
click
Description: Simulates a click on a specified element.
Usage: { "click": ["selector"] }
Example: { "click": ["#submit-button"] }
type
Description: Types a given text into an input field.
Usage: { "type": ["selector", "text"] }
Example: { "type": ["#username", "testUser"] }
reload
Description: Reloads the current page.
Usage: { "reload": [] }
Description: Scrolls the page by a relative amount. Maps to Puppeteer’s scroll function.
Usage: { "scrollRelative": ["x", "y"] }
Example: { "scrollRelative": [0, 500] } (scrolls 500px down)
Description: Scrolls the page until a specified element is in view.
Usage: { "scrollIntoView": ["selector"] }
hideElement
Description: Hides a specified element on the page by setting its visibility.
Usage: { "hideElement": ["selector"] }
Example: { "hideElement": [".popup"] }
urlMatch
Description: Checks if the current URL matches a given regular expression pattern.
Usage: { "urlMatch": ["pattern", "flags"] }
Example: { "urlMatch": ["/login", "gi"] }
Macro Functions
Description: Sets a basic authorization header for HTTP requests.
Usage: { "setBasicAuthorizationHeader": ["username", "password"] }
Example: { "setBasicAuthorizationHeader": ["user1", "password123"] }
authMicrosoftSSO
Description: Automates the login process using Microsoft Single Sign-On (SSO).
Usage: { "authMicrosoftSSO": ["username", "password"] }