Execute a web page including running JavaScript in a headless browser using PuppeteerSharp.
Both anonymous and authenticated pages will be loaded.
The component will load an authenticated page and handle the redirect to the login page if it occurs and username and password are provided. The login page must handle deep linking to return to the requested page.
Installation
Install the Puppeteer forge component.
The Puppeteer_IS module and Puppeteer_Ext extension will be installed.
Configuration
To see trace logs in the General log, set the site property IsDebug to True in Puppeteer_IS.
Exposed Actions
The actions exposed in Puppeteer_IS are:
Puppeteer_Browse Browse to the URL
Puppeteer_BrowseAndActions Browse to a URL. Then perform the specified actions. Returns the results of STOREVAR and GETVALUE actions.
Puppeteer_LoginAndBrowse Browse to a URL, and if redirected to the Login page, login with the provided credentials
Puppeteer_LoginBrowseAndActions Browse to a URL, and if redirected to the Login page, login with the provided credentials. Then perform the specified actions. Returns the results of STOREVAR and GETVALUE actions.
Puppeteer_InstallDefaultBrowser Install the default browser. The Browse actions will install the default browser automatically.
Puppeteer Actions
The available actions are:
GOTO Navigate to a URL. The Value is the URL to navigate to, the Selector is the element to wait for after navigation.
CLICK Click on an element. The Selector is the element to click on.
CLICKGOTO Click on an element and then wait for navigation to another page. The Selector is the element to click on.
TYPE Type a value into an element. The Selector is the element to type into, the Value is the value to type.
WAIT Wait for an element to become visible. The Selector is the element to wait for.
STOREVAR Selector = The name of a variable to store a value. Value = The expression to evaluate to produce the value.
GETVALUE Value = The expression to evaluate to retrieve the value. Before the expression is evaluated, any text formatted as ${VARIABLE} will be replaced with the stored variable. If there is no stored variable the ${VARIABLE} text will be left unchanged.
Structures
Puppeteer_BrowseR
Url: Browse to this URL. Wait until the page is loaded and there is no further network activity.
TimeoutSeconds: Wait timeout in seconds.
WaitForSelector: Wait for the element defined by this CSS selector to appear. If empty, processing will continue after the page is loaded.
ScreenHeight: View port height in px
ScreenWidth: View port width in px
Puppeteer_LoginR Record to use for logging in
Username: Login with this username. Only used if the login page appears, which is determined by the presence of an element matching the LoginPageSelector.
Password: Login with this password. Only used if the login page appears, which is determined by the presence of an element matching the LoginPageSelector.
LoginPageSelector: CSS selector to identify the login page. Whether a page is the login page is determined by the presence of an element matching this LoginPageSelector.
LoginButtonSelector: CSS selector for the login button eg ".login-form button.btn-primary"
UsernameSelector: CSS selector for the username input eg "#Input_UsernameVal"
PasswordSelector: CSS selector for the password input eg "#Input_PasswordVal"
TimeoutSeconds: Timeout in Seconds. Uses the browse timeout if less than zero. Defaults to -1.
Puppeteer_ActionR An action to perform
ActionId: Identifier for the action. GetValue actions must have an id.
Action:
GOTO Value = URL to navigate to, Selector = Wait for this element to appear after navigation.
CLICK Selector = The element to click on.
CLICKGOTO Selector = The element to click on. After click will wait for navigation.
TYPE Selector = The element to type into, Value = The value to type.
WAIT Selector = The element to wait to become visible.
Selector: CSS selector to identify the target element if required by the action.
Value: The value if required by the action.
TimeoutSeconds: Wait timeout in seconds. If -1, the browse timeout is used.
Condition: An expression that evaluates to a boolean result. If specified, only execute this action when the condition returns true.
SkipToActionIdOnFalse: An action Id to skip to. If the Condition is specified and it evaluates to false and this is specified, skip over Actions until the Action matching this Id is reached. Start executing again at the matching Action. If not matching Action is found, actions will continue processing from the next action.
Puppeteer_ResultR The result of an action. Returned in the order actions are specified. GETVALUE and STOREVAR actions return results.
ActionId: The Id of the action that returned the value.
Expression: Text(2000) The expression used to generate the value.
Value: Text(2000). The value returned by the action.
Puppeteer_BrowseAndActions Browse to a URL. Then perform the specified actions.
Puppeteer_LoginBrowseAndActions Browse to a URL, and if redirected to the Login page, login with the provided credentials. Then perform the specified actions.