Skip to main content

Automate websites and terminals

An Unstract Flow workflow can work a system that has no API: a website, a server's command line, or a mainframe screen. You describe what a person would do there, step by step, and Flow does it in one session. Use it when the system you need offers only a screen.

ConnectorMentionWorks with
Browserless@browserlessWebsites, in a hosted browser.
SSH Terminal@terminal_sshA server's command line over SSH.
Mainframe Terminal (3270)@terminal_3270IBM 3270 mainframe screens.

Describe the session in the spec​

Write the session as one step, in the order a person would do it. Say what to type and where, which key to press, what to wait for, and which values to keep.

With @terminal_ssh, in one session: run hostname and keep its output as the machine name. Run uptime -p and keep its output as the uptime. Return both.

Flow follows the description literally, so leave nothing to judgment:

  • Name every field, button and key: "type the policy number in the Policy field, then press Enter".
  • Name a choice by the words on the option: "choose Civil in the Case Type list". This works for a page's own drop-down list and for lists a site builds itself, including ones you can't type in. In a list a site builds, Flow waits up to 10 seconds for the option to appear, so a list that loads its options, or looks them up as you type, works too. When the option doesn't appear, the step fails with "No option named 'Civil' in the list".
  • Say what marks the end of a wait: "wait until the Results table appears".
  • Give a loop its limit: "read at most 20 rows".
  • Name each value the workflow uses afterwards: "keep the status as claim_status".

A value that changes from run to run, such as a policy number from an earlier step, can be named in the description. For a password or other secret, write {{secret:NAME}}. Secrets explains how to store one.

Keep one session in one step. Each step opens a new session, so a session split across two steps signs in twice and loses its place.

Prepare and run​

When you prepare the workflow, Flow turns each description into the exact steps it will perform. The Activity list on the Prepare tab shows "Compiling website and terminal steps..." while it does.

Prepare the workflow again after you change a session's description, and move any deployment to the new version, or its runs keep doing what the old description said. The same goes for the Key Mappings default on a 3270 step: each version keeps the one it was prepared with, so a change reaches only the versions you prepare after it. Default inputs shows where Key Mappings is set.

When a session starts during a run in the editor, a viewer opens with the screen as Flow sees it and the step in progress. For a terminal that is the screen itself; for a website it is the page's text. An Execution log below it lists each action. The log records the length of each thing typed, not the text. Once you close the viewer it stays closed for that run.

Browserless​

The credential is the API Token from your Browserless account.

SettingDefaultWhat it does
Browser EndpointStealth (fingerprint randomization, recommended)The browser to use. The others are Chrome (genuine Google Chrome) and Chromium (open-source).
Browser Session Limit (ms)300000The longest one browser session stays open, five minutes by default. It can be from 30,000 to 900,000. A session that needs longer is cut off.
Human-Like DelaysOnTypes and clicks with pauses, as a person does.
ProxyNoneResidential sends the session through a residential address. Proxy Country (ISO 3166) picks the country. Proxy Country (ISO 3166), Proxy Preset and Sticky Proxy IP work only with Residential. Save Settings refuses a Proxy Country while Proxy is None. A step on an instance saved that way before fails and names the setting to fix.
Proxy PresetEmptyThe identifier of a proxy preset from your Browserless account, used with a Residential proxy.
Sticky Proxy IPOffKeeps one address for the whole session.
Block AdsOnBlocks advertising on the pages.
Auto-solve CaptchasOnHas Browserless solve a CAPTCHA it finds on a page.

In a run, Flow closes a consent pop-up that blocks a step.

Chrome (genuine Google Chrome) and Chromium (open-source) run without a window, and their User-Agent says "HeadlessChrome". Some sites refuse that: one court portal answers 401 to every document link. On these two endpoints Flow sends the browser's User-Agent with "HeadlessChrome" written as "Chrome", together with the browser's client hints (Sec-CH-UA and navigator.userAgentData), any "HeadlessChrome" brand in them written as "Google Chrome". It does this for each new session, in runs and in explorations. Stealth (fingerprint randomization, recommended) already says "Chrome" and is left as it is.

Limitations

The User-Agent is replaced for the page a session opens and the requests it sends. A frame from another site, such as a CAPTCHA widget or a document viewer, and a worker the page starts still say "HeadlessChrome". For a site that checks the User-Agent there, use Stealth (fingerprint randomization, recommended). When Flow can't read the browser's client hints, or the change takes more than 15 seconds, the session keeps "HeadlessChrome".

An exploration in Flow Chat sets four of these for its own sessions, whatever the instance says: Browser Endpoint (Chromium, or Stealth when Chromium can't connect or the start address refuses it), Human-Like Delays off, Browser Session Limit (ms) 900,000 (or the instance's limit when your Browserless account refuses that), and Auto-solve Captchas on. Explore a live website describes how an exploration uses them. Runs use the instance's settings.

SSH Terminal​

The credential holds the Username, and a Password or a Private Key. When the key is protected by a passphrase, enter it in Key Passphrase. Set Authentication Method to match.

SettingDefaultWhat it does
HostnameNone, requiredThe server's address.
Port22The SSH port.
Authentication Methodpasswordpassword or key.
Allowed Host FingerprintsNoneThe server fingerprints this instance trusts, one per line or separated by commas. Paste them as Test Connection shows them (SHA256: followed by the digest). A whole ssh-keygen -l line works too. An MD5 fingerprint (32 hex digits, with or without MD5: and the colons) also works.
Proxy Jump HostNoneA bastion host to connect through, written as [user@]host[:port]. One bastion only. Add the bastion's fingerprint to Allowed Host Fingerprints as well as the target's.
Terminal Rows40The height of the screen.
Terminal Columns120The width of the screen.
Initial Content Timeout (seconds)5How long to wait for the prompt after signing in. Raise it for a slow connection.
Max Output Bytes52428800 (50 MB)The most output one session may receive.

Until Allowed Host Fingerprints holds the server's fingerprint, Test Connection and every run fail, and both show the fingerprints the server offers. Paste one into Allowed Host Fingerprints, save, and test again. If the server's key changes later, Flow refuses to connect until you add the new fingerprint.

Mainframe Terminal (3270)​

This connector has no credential. Put the sign-in in the session's description, with the password as a secret.

SettingDefaultWhat it does
HostnameNone, requiredThe TN3270 server's address.
Port23The port. TLS servers commonly use 992.
Use TLSOffEncrypts the connection.
Verify TLS CertificateOnChecks the server's certificate.
TLS CA CertificateNoneYour own certificate authority, for a server that uses one.
Terminal Model22 is 24 rows by 80 columns. 5 is 27 by 132.
Initial Content Timeout (seconds)10How long to wait for the first screen.
Max Output Bytes52428800 (50 MB)The most output one session may receive.

Where your application gives keys its own meanings, say so in the step: "PF3 exits, PF8 pages forward". Flow uses those meanings to choose the keys it presses, except for an action the step's Key Mappings lists. A step that names an action without a key, such as "go to the next page", gets its key from Key Mappings: with {"PF10": "next page"}, Flow presses PF10 for it. The mapping also wins over a key in the description, so "press PF8 to go to the next page" presses PF10 too. An action that neither Key Mappings nor the description gives a key gets the standard 3270 key: PF8 for the next page, PF7 for the previous page and PF3 to go back.

Limitations
  • A session step fails after 16 minutes. A failed session step isn't retried, even when the worker running it restarts: the run fails at that step, unless the spec says to continue past it.
  • A workflow can hold at most 25 different session descriptions. Preparing one with more fails.
  • A workflow prepared before Flow could run these steps has to be prepared again.
  • A Proxy Jump Host takes one bastion, not a chain of them, and the bastion has to be a different server from the target. Flow checks the bastion's host key against Allowed Host Fingerprints too, so both fingerprints have to be there; Test Connection checks both and names whichever is missing, so you can add it before running anything. The target itself still has to be reachable from Flow for its fingerprint to be read, so a server reachable only through the bastion doesn't work yet.