Skip to main content

Automating a browser

Fifteen minutes. The last core skill, and the one most real RPA work needs: driving a browser. You will launch Chrome, open a page, read something off it, and close it down — and learn the one idea that makes browser automation click.

What you need

  • Tutorial 6 finished
  • Google Chrome installed on the machine the robot runs on
  • The Robomotion Chrome extension — needed for Inspect, which is the part of this tutorial that matters most

The flow you are building

The finished flow

Six nodes. Build them in order — each one earns its place.

1. Launch a browser

Add an Inject node renamed Start, then Browser → Open renamed Launch Browser.

Start and Launch Browser

Set Browser to chrome.

Run it. Chrome opens and stays open — the flow ends but the window remains, which is worth seeing once so the last step makes sense.

2. The browser id — the one idea to take away

Launch Browser writes a browser id onto the message. Every browser node after it takes that id as an input.

Add Browser → OpenLink renamed Open Page:

Open Page added

PropertyValue
Browser IdMessage → browser_id
URLCustom → https://robomotion.io

That id is how Robomotion knows which window you mean. It is why a single flow can drive two browsers at once — keep their ids in different fields — and it is why ordering matters: a browser node that runs before Launch Browser has no id to use.

The most common first mistake

"It says no browser." Nine times out of ten the node is missing its Browser Id, or it sits before the node that creates one.

3. Read something off the page

Add Browser → GetValue renamed Read Heading:

Read Heading added

PropertyValue
Browser IdMessage → browser_id
Selector//h1
ValueMessage → heading

Run it and put a Debug node after it: the page's first heading is now on the message, and the flow can branch on it, write it to a sheet, or send it somewhere.

4. Close what you opened

Add Browser → Close renamed Close Browser — Browser Id again — and a Stop.

The finished flow

Leaving browsers open is the classic way to fill a robot's memory over a weekend of scheduled runs. Close what you open.

Selectors — the actual skill

Launching a browser is easy. The hard part is telling the robot which thing on the page to act on, and that is what a selector does. Robomotion uses XPath:

SelectorMatches
//h1the first heading
//*[@id="search"]the element whose id is search
//button[text()="Submit"]a button whose visible text is exactly Submit
//div[@class="price"]//spana span inside a div of class price

You do not have to write these. With the extension installed, browser nodes have an Inspect button: press it, click the element on the page, and the selector is filled in for you. There is also a recorder that watches you do the task once and writes the nodes.

See Inspect and Record.

Choosing a selector that lasts

Inspect offers a working selector; a durable one is a judgement call. Prefer an id, a data- attribute or visible text over a long chain of generated class names — those change at the site's next deploy and your flow breaks on a Tuesday for no visible reason.

When you are ready for the real thing

This flow is deliberately bare. A browser automation you would actually schedule adds things this one leaves out — asking the user for input, retrying when a page fails to load, catching errors, giving up gracefully after N attempts.

The Open a Web Page template in Start with an example is exactly that flow: the same six nodes, plus a Catch, a retry loop built from Go To and Label, and a Function node that tidies whatever the user typed before it is used as a URL.

Import it and read it now that you know what the middle of it is doing. That is the shape real work takes, and none of it is new — it is tutorial 5 and tutorial 4 applied to a browser.

What you have learned

  • A browser session is identified by a browser id that every node passes along
  • Selectors say which element, and Inspect writes them for you
  • Close what you open

Next

You have finished the seven tutorials. You can read any template in the library and change it.

Browser package reference — every node, including the ones this tutorial did not use: clicking, typing, scraping tables, switching frames and windows.