Kant Plugin
This plugin provides an embedded Edge browser along with an associated app type so web pages can be automated. It mostly works the same as the Legacy Hosted Chrome app as well as the Krom plugin which also wraps a chrome browser.
This plugin is supported in Manatee v1.28+.
System requirements
This plugin requires the WebView2 Runtime to be installed. The installer comes as a free download from Microsoft. See here
Setting up for automation in Manatee 1.28
There are a number of steps involved in order to successfully launch and attach a web app using this plugin. They are summarized in the following checklist:
- Identify set of groups for machines that should have the plugin (GROUPS)
- Identify headless app (HEADLESS_APP) that can be used for starting the plugin and the browser
- Create headless flow (PLUGIN_START) for starting the plugin
- Set GROUPS on HEADLESS_APP and PLUGIN_START
- Register hosted edge plugin app type in cuesta via a manatee with the running plugin (if the app type isn’t already made available)
- Create headless flow (EDGE_START) in HEADLESS_APP for launching the browser (and reload Cuesta)
- Add
url
input parameter to EDGE_START flow - Set up a Manatee Boot trigger on PLUGIN_START
- Create plugin-edge-app (PLUGIN_EDGE_APP)
- Set GROUPS on PLUGIN_EDGE_APP
- Set
Launch With
to something like `manatee:runflow/withname/PLUGIN_START?url=https:%3A%2F%2Fdr.dk - Set
Executable-path contains
toKant.exe
- Set
Title bar contains
to the launch url
PLUGIN_START flow
This flow gets run after Manatee startup and is responsible for starting the plugin. Note that it references the plugin version, so when updating the plugin, this flow needs to change.
var kantVersion = '0.0.24';
try {
Plugin.start('KantPlugin', 'v' + kantVersion, {
'[eu.sirenia]CurrentWorkingDirectory': ('%appdata%\\Sirenia\\Manatee\\plugins\\KantPlugin\\' + kantVersion).toString()
});
//Notification.show('kant', 'Plugin started', 'KantPlugin v' + kantVersion, { timeout: 3 });
} catch(e) {
Notification.show('kant', 'Plugin failed to start', e && (e.message || e) + '\nv' + kantVersion, { severity: 'warn', timeout: 20 });
}
EDGE_START flow
This flow is used when Manatee needs to start a new instance of the hosted edge browser, Kant. Note that this flow also references the version of the plugin.
var kantBrowser = Module.load('KantBrowser', { version: '0.0.24' });
kantBrowser.launch(Inputs.url, {});
Options for the browser
When passing a settings object to the kant plugin and its browser, a number of options can be set. The following is an example of a settings object:
{
"url": "https://www.google.com",
"browserSwitches": "enable-media-stream=1,enable-profanity-filter=0",
"displayMode": "NavWithLocation",
"popupBehavior": "Navigate",
"ignoreCertErrors": true,
"writeableCachePath": "C:\\Users\\user\\AppData\\Local\\Temp\\cordless",
"preApprovals": "notifications,geolocation",
"lang": "en-US",
"clientCertRegex": ".*",
"downloadPath": "C:\\Users\\the-user\\Downloads"
}
This object comes into play in various ways depending on how the plugin is started and how the browser is launched.
Launch flow:
The settings object must be returned from the flowkantBrowser.launch:
The settings object is passed as the second argumentPlugin.start:
The settings object is passed as the third argument
The table below puts a few more words on the available options:
Option | Description | Example |
---|---|---|
url | The url to navigate to after startup | ‘https://www.google.com’ |
browserSwitches | Switches for the embedded browser engine | [‘enable-media-stream=1’, ‘enable-profanity-filter=0’] |
displayMode | General appearance. One of Default, NoNav, NavWithLocation | ‘NoNav’ |
popupBehavior | What to do when the page requests a popup. One of Default, Prevent, Navigate, Chromium | ‘Prevent’ |
ignoreCertErrors | Ignore expired ssl certificates on the sites visited | true |
writeableCachePath | Where on disk the browser should write its cache, cookies etc | ‘%APPDATA%\Kant\MySession’ |
preApprovals | Pre-approved page permissions. Saves the user from handling permissions | [‘camera’, ‘microphone’] |
lang | Language to use for the browser user interface - also passed to the pages visited | ‘en-US’ |
clientCertRegex | When the user has multiple client certificates, this helps the robot choose automatically | ‘.*’ |
downloadPath | Set default download path so files are easier for the robot to download | ‘%USERPROFILE%\Downloads’ |
Note that environment variable expansion of the path options is available from v1.200.25 of the plugin.