PALATINELABSDocsENES

Pages

↑↓ to moveEnter to openEsc to close

Browser package guide

Drive the person's Chrome or Edge through Janus, run page JavaScript, and download or check resources over HTTP.

Version 3.2.0. Installed versions can differ. Examples are illustrative and not tested. See Packages.

Jump to actions

Prerequisites

Shared fields

These fields mean the same in each action that has them.

InputEditor fieldType, defaultValue
windowWindowWindow⁠, emptyA captured Window, such as $browserWindow$⁠. Empty: page actions and Close use the window this Run opened last, if still open, or else the tab used last. Open uses the tab used last.
frameFrameString⁠, emptyCSS selector of an iframe, such as iframe#preview⁠. Empty: the page.
timeoutValueTime out after (seconds)Number⁠, 30Seconds to wait for each browser call, not the whole action. 0 or less: 30, or 60 for Download file.
browserBrowserBrowserKind⁠, DEFAULTCHROME or EDGE⁠. DEFAULT⁠: the browser of the tab used last, or the Windows default browser for Open. INTERNET_EXPLORER⁠, FIREFOX and SAFARI are only for old steps: Open cannot start them, and other actions then match any browser.
url(per action)String⁠, emptyRequired. A full URL. Open accepts https://⁠, http:// and file://⁠.
filePath(per action)String⁠, emptyA full path, or a path relative to the automation folder. Missing folders are created.

Actions

Call a JavaScript function (browserCallJavaScriptFunction)

Call a function that the page already has, and get its return value.

Inputs

InputEditor fieldType, defaultValue
functionNameFunction nameString⁠, emptyRequired. Such as sample.add⁠. Only letters, digits, _⁠, $ and .⁠.
functionArgumentsArgumentsList⁠, empty ListSuch as $addArguments$⁠. Strings are passed in quotes; Numbers, Booleans, Lists and Dictionaries as JavaScript values. Empty: no arguments.
returnJavaScriptTypeReturn TypeJavaScriptType⁠, STRINGNONE⁠: give an empty String. STRING⁠, NUMBER⁠, BOOLEAN⁠, LIST⁠, DICTIONARY⁠: give the value as text.

Also uses the shared fields window, frame and timeoutValue.

Outputs

OutputTypeValue
resultStringStrings stay plain. Other values become JSON text.

Example

Run window.sample={add:(a,b)=>a+b} with Run JavaScript. Make the List $addArguments$ with Numbers 2 and 3. Set window=$browserWindow$, functionName=sample.add, functionArguments=$addArguments$, returnJavaScriptType=NUMBER. Bind result to $sumText$.

Expected result

$sumText$ is 5. If the function or iframe is not found, the step fails.

Back to actions

Close (browserClose)

Close a tab or its whole window.

Inputs

InputEditor fieldType, defaultValue
whatToCloseWhat to closeCloseOption⁠, WindowTab⁠: the tab only. Window⁠: the window with all its tabs.

Also uses the shared fields browser, window and timeoutValue.

Outputs

None.

Example

Set whatToClose=Tab, browser=CHROME, window=$browserWindow$.

Expected result

The tab closes; other tabs stay open. Closing the last tab also closes the window. If the tab is not found or Janus is not connected, the step fails.

Back to actions

Download file (browserDownloadFile)

Download a file from a URL, without the browser or its sign-ins.

Inputs

InputEditor fieldType, defaultValue
overwriteOverwrite existing fileBoolean⁠, falsefalse⁠: fail if the file exists. true⁠: replace it when the download is complete.
allowInternalNetworkAllow an address inside the networkBoolean⁠, falsefalse⁠: refuse an address on this PC or in your private network, also after a redirect. true⁠: allow it.

Also uses the shared fields url (URL of file), filePath (Save to location, required) and timeoutValue (default 60).

Outputs

OutputTypeValue
fileAnyThe downloaded file. Bind it to a File variable.

Example

Put https://example.com/automation-samples/invoice.txt with the text Invoice sample on your server. Set url to it and filePath=samples/invoice.txt. Bind file to $downloadedFile$.

Expected result

The file contains Invoice sample. If the download fails or times out, the step fails and leaves no partial file.

Back to actions

Check the links on a page and list the ones that do not work, without a browser.

Inputs

InputEditor fieldType, defaultValue
scopeScopeLinkScope⁠, onlyThisPageonlyThisPage⁠: this page. wholeWebSite⁠: also linked pages on the same host, up to 50 pages. Links to other sites are checked too. Links made by page scripts are not found.
appendToExistingFileAppend to already existing csv fileBoolean⁠, falsetrue⁠: add rows to the CSV without a second header. Use its encoding. false⁠: replace the CSV.
encodingEncodingCsvEncoding⁠, UTF8ansi⁠: the Windows code page. UTF8⁠: UTF-8. unicode⁠: UTF-16, for older Windows tools.
parallelThreadsNumber of parallel threadsNumber⁠, 8Links checked at the same time, 1 to 99.
timeoutTime out (Sec)Number⁠, 30Seconds for each request. 0 or less: 30.
allowInternalNetworkAllow an address inside the networkBoolean⁠, falsefalse⁠: refuse an address on this PC or in your private network, also after a redirect. true⁠: allow it.

Also uses the shared fields url (Page or URL) and filePath (Save list to location, empty: no CSV, only the Table).

Outputs

OutputTypeValue
resultTableBroken links sorted by URL: String column url⁠, Number column status⁠.

Example

Make a page https://example.com/automation-samples/links with a link that works and a link to https://example.com/automation-samples/missing, which returns 404. Set url to the page and filePath=samples/broken-links.csv. Bind result to $brokenLinks$.

Expected result

The Table has one row: the missing link with status 404. The CSV starts with url,status. A page with no broken links gives zero rows. Status 0 means not reachable; 400 or more means broken. If the first page cannot be read, the step fails.

Back to actions

Get source code (browserGetSourceCode)

Read the page HTML as it is now in the browser. It can differ from the file the server sent.

Inputs

Uses the shared fields window, frame and timeoutValue.

Outputs

OutputTypeValue
resultStringThe HTML.

Example

On a page with <p>Invoice sample</p>, set window=$browserWindow$. Bind result to $pageHtml$.

Expected result

$pageHtml$ contains the sample paragraph. If the page or iframe is not found, the step fails.

Back to actions

Go back (browserGoBack)

Go back in the tab's history.

Inputs

InputEditor fieldType, defaultValue
noOfStepsNumber of steps backNumber⁠, 1Pages to go back. 0 or less fails.
errorThrownForExceedStepsThrow an error if steps exceed historyBoolean⁠, falsetrue⁠: fail if the tab cannot go back at all.

Also uses the shared fields window and timeoutValue.

Outputs

None.

Example

In the sample tab, visit /automation-samples/first, then /automation-samples/second. Open no other window in the Run. Set window empty and errorThrownForExceedSteps=true.

Expected result

The tab is back on the first page. If there is no earlier page, the step fails. If you ask for more steps than there are pages, it goes back as far as it can and passes.

Back to actions

Open (browserOpen)

Open a web or file address in the person's Chrome or Edge profile.

Inputs

InputEditor fieldType, defaultValue
openOptionWhat to openOpenOption⁠, NEW_WINEXISTING_TAB⁠: go to the URL in the matching tab. NEW_TAB⁠: a new tab beside it, or in the current window if window is empty. NEW_WIN⁠: a new window. If no tab matches, a new window opens.
closeAtEndClose it when the run endsBoolean⁠, falsetrue⁠: close a new window when the Run ends or stops. A Run that times out can leave it open. Tabs are not closed.

Also uses the shared fields browser, window (only for EXISTING_TAB and NEW_TAB), url (Link to open) and timeoutValue.

Outputs

None.

Example

Set browser=CHROME, url=https://example.com/automation-samples/, closeAtEnd=true.

Expected result

A new Chrome window shows the page. Later page steps with an empty window use it. It closes when the Run ends. A bad URL, or a page that Janus cannot find, fails the step.

Back to actions

Run JavaScript (browserRunJavaScript)

Run JavaScript in the page, with access to the page's functions.

Inputs

InputEditor fieldType, defaultValue
scriptOptionJavaScript to runScriptOption⁠, SCRIPTSCRIPT⁠: run script⁠. FILE⁠: run the text of a file.
fromFile fromFileFrom⁠, DeviceFor FILE⁠. Device⁠: a file on the Device. Room⁠: a file in the room.
fileJavaScript fileString⁠, emptyFor from=Device⁠. A .js file relative to the automation folder, such as samples/title.js⁠.
roomFileJavaScript file in the control roomFileRef⁠, emptyFor from=Room⁠. Pick a .js file in the room's file picker.
scriptEnter script hereString⁠, emptyFor SCRIPT⁠. It runs like the page's own code and returns the last value, such as document.title⁠.

Also uses the shared fields window, frame and timeoutValue.

Outputs

OutputTypeValue
resultStringThe value. Values that are not strings become JSON text. No value: an empty String.

Example

On a page titled Invoice sample, set window=$browserWindow$ and script=document.title. Bind result to $pageTitle$. For a file, put document.title in samples/title.js and set scriptOption=FILE, file=samples/title.js.

Expected result

$pageTitle$ is Invoice sample. If the script or file is empty or missing, the iframe is not found, or the script fails or runs too long, the step fails.

Back to actions

Switch tab (browserSwitchTab)

Select a tab and bring its window to the front.

Inputs

Uses the shared fields window (required) and timeoutValue.

Outputs

None.

Example

Capture the sample page into $browserWindow$, then click another tab. Set window=$browserWindow$.

Expected result

The sample tab is selected. If no tab matches or Janus is not connected, the step fails.

Back to actions