BROWSER

Browser vs SeleniumLibrary

The long-standing Robot Framework web library, built on Selenium WebDriver.

Compared against SeleniumLibrary 6.7 on Selenium 4, Browser 20.4.0

Some of us maintained SeleniumLibrary for years before starting Browser, and its current maintainers are our friends. It is a good library, it is actively maintained, and for a great many projects it is the right answer.

So this page is facts, not persuasion. Two libraries, two underlying technologies, and what actually differs.

The same test, both ways

*** Settings ***Library     Browser*** Test Cases ***Test Eight Components    New Browser    chromium    headless=No    New Page    https://www.selenium.dev/selenium/web/web-form.html    Get Title    ==    Web form    Type Text    [name="my-text"]    Selenium    Click    button    Get Text    id=message    ==    Received!
Robot Framework12 linesUTF-8
*** Settings ***Library     SeleniumLibrary*** Test Cases ***Test Eight Components    Open Browser    https://www.selenium.dev/selenium/web/web-form.html    chrome    Title Should Be    Web form    Input Text    name:my-text    Selenium    Click Button    css:button    Wait Until Element Is Visible    id:message    Element Text Should Be    id:message    Received!    [Teardown]    Close Browser
Robot Framework13 linesUTF-8

12 lines vs 13

  • Selenium's own "eight components" example, written with each library.
  • Browser's getters assert, so Get Text does in one line what Wait Until Element Is Visible plus Element Text Should Be does in two.
  • Neither file is unreadable. This is not the interesting difference.

The code is not where the gap is. The gap is underneath.

How the two talk to the browser

Browser (Playwright)SeleniumLibrary (WebDriver)
ProtocolOne persistent WebSocket connection to the browserW3C WebDriver, an HTTP request per command
What it launchesBrowser builds Playwright downloads and pinsThe browser installed on the machine, through a driver
Extra binariesrfbrowser init downloads browsers; no per-browser driverA driver per browser, resolved by Selenium Manager since 4.6
Version couplingBrowsers are pinned to the Playwright version, so they match by constructionDriver and browser must stay in step as the browser auto-updates

The protocol difference is the origin of most of the rest. A command per HTTP round trip means every element lookup, every check and every retry is another request; it also means the browser can change between two of them, which is where StaleElementReferenceException comes from.

Waiting

This is the single largest practical difference.

Browser performs Playwright's actionability checks before every action. For a click, all five must pass: the element is visible, stable (unmoved for two animation frames), receives events (nothing is on top of it), enabled, and for typing also editable. It retries until they do or the timeout expires, and the failure names the check that never passed.

SeleniumLibrary offers an implicit wait — a global timeout applied to element lookup, and lookup only — plus explicit Wait Until ... keywords you place yourself. Selenium waits for document.readyState on navigation, which, as its own documentation notes, "only concerns itself with loading assets defined in the HTML" — a JavaScript-rendered page is not covered.

BrowserSeleniumLibrary
Before an actionFive actionability checks, automaticallyNothing beyond the implicit lookup wait
Element under an overlayWaits for the overlay to go, then clicksClicks, and the overlay receives it
Element still animatingWaits for it to stopClicks mid-animation
DOM re-render between lookup and useLocator re-resolvesStaleElementReferenceException
Explicit waits in a normal testRareCommon

That last row is the one you feel. Wait Until Element Is Visible before a click is a line SeleniumLibrary suites are full of, and Browser suites do not have.

Selectors

StrategyBrowserSeleniumLibrary
CSS, XPath, id, name, class, tagYesYes
Link textVia text=link: and partial link:
By accessible role and name (role=)YesNo equivalent
Visible text as a first-class engine (text=)Yes, substring or exactAnchors only
Chaining several strategies>>>>
Open shadow DOMPierced automaticallyNot a locator strategy; needs the shadow root through JavaScript
Crossing into an iframe>>> inside the same selectorSelect Frame, then Unselect Frame
More than one matchStrict mode by default — an errorFirst match wins

Role selectors are the substantive addition. role=button[name="Save"] matches what the element is and what it is called — the two things a screen-reader user navigates by — so it survives a redesign that moves the button and rewrites the markup around it. There is no WebDriver equivalent; you approximate it with XPath over ARIA attributes.

Shadow DOM is the other. Selenium 4 can reach a shadow root via getShadowRoot() per host, so it is possible; it is not a selector, so it does not compose with the rest of a locator, and it does not nest without work.

Diagnosing a failure

BrowserSeleniumLibrary
Screenshot on failureYes, in the Robot Framework logYes, in the Robot Framework log
Video of the runNew Context with recordVideo=…Not built in
TraceNew Context with tracing=True — DOM snapshots per action, network, console, timelineNo equivalent
Network inspectionBuilt in, including request interceptionVia CDP, Chromium only

The trace is the part with no counterpart. A Playwright trace is a recording you open afterwards and step through: for every action, the DOM as it was, with DevTools over it, plus the network and console at that moment. It is the difference between "the click failed" and seeing the element you meant to click sitting behind a cookie banner.

Browsers and platforms

Where SeleniumLibrary is genuinely ahead — and it is worth being straight about this, because it decides real projects:

BrowserSeleniumLibrary
EnginesChromium, Firefox, WebKitChrome, Edge, Firefox, Safari, and more via WebDriver
The actual shipped browserPlaywright's builds; real Chrome or Edge via channelAlways the real installed browser
Safari properNo — WebKit is the same engine, not the same browserYes, safaridriver
Internet Explorer, legacy browsersNoYes
Remote executionPlaywright browser server, or Connect To BrowserSelenium Grid, which is mature and widely deployed
MobileDevice emulationEmulation, and real devices through the Appium ecosystem

If you must certify against Safari itself rather than WebKit, or you have an established Selenium Grid, or a stakeholder requires the vendor's own browser under test, SeleniumLibrary is not the compromise — it is the correct tool.

Performance

We are not going to publish a benchmark, because a benchmark of two tools on one suite mostly measures the suite. The structural reasons Browser tends to be faster are stateable without one:

  • One connection instead of many requests. Every WebDriver command is an HTTP round trip; Playwright multiplexes over a single WebSocket.
  • No per-element round trips for waiting. Actionability is evaluated in the browser rather than polled from outside.
  • Contexts instead of browsers for isolation. New Context gives a clean, isolated profile in a few milliseconds; a fresh Selenium session starts a browser.
  • One Node process for all three engines, rather than a driver process per browser.

Flakiness follows the same logic. Most of it comes from acting on an element that was not ready, and the actionability checks remove that category rather than mitigating it.

Choosing

ChooseWhen
SeleniumLibraryYou need Safari, IE or another WebDriver-only browser; you have a Selenium Grid; you have a large suite that works, and rewriting it buys nothing; your organisation standardises on WebDriver.
BrowserYou are starting fresh; your app is a JavaScript-heavy SPA; you keep writing explicit waits; you need shadow DOM, iframes or role selectors; you want traces and video; suite runtime matters.

There is no obligation to migrate. Both libraries are maintained, both are Robot Framework libraries, and they can live in the same project — one suite on each, sharing everything else. Starting Browser has never required abandoning SeleniumLibrary.