Semantic Overloading in Browser Library Keywords - Feedback & Suggestions

Hi everyone,
I’ve been working extensively with Browser Library and noticed a pattern that I think is worth discussing with the community.

:magnifying_glass_tilted_left: Observation
Some keywords in Browser Library seem to combine multiple responsibilities, which may go against the traditional Robot Framework philosophy of clear, single-purpose keywords.
For example:
:white_check_mark: Traditional RF Style (e.g., SeleniumLibrary)

Get Text → retrieves text.
Get Title → retrieves the page title.
Assertions are done separately using Should Be Equal, Should Contain, etc.

:warning: BrowserLibrary Style

Get Text selector == Expected Text
Get Title == Expected Title
Get Attribute selector attribute == Expected Value
Get Url contains /dashboard
Get Element States selector == visible
Wait For Response matcher == 200

These keywords perform both retrieval and validation, which can:

Reduce readability.
Break user expectations (especially for those migrating from SeleniumLibrary).
Make debugging harder due to hidden assertions.
Limit reusability in variable assignments.

:light_bulb: Suggestions

  1. Split responsibilities:
  • Keep Get Text, Get Title, etc., as pure getters.
  • Introduce separate assertion keywords like Text Should Be, Title Should Be, etc.
  1. Rename overloaded keywords:
  • If combining retrieval and validation is necessary, use names like Validate Text, Assert Title, etc.
  1. Improve documentation clarity:
  • Clearly highlight when a keyword performs assertions based on optional arguments.

:folded_hands: Why This Matters
Robot Framework is known for its readable and maintainable test syntax, and I believe keeping keyword semantics clean will help:

  • New users onboard faster.
  • Teams maintain large test suites more easily.
  • Reduce surprises during test execution.

Would love to hear thoughts from others — especially from those using Browser Library in production or contributing to its development.
Thanks in advance!

1 Like

This is an Historical problem of Evolution.

SeleniumLibrary (Selenium2Library) was based in Selenium in Java.

Browser is based in Playwright (NodeJS).

The original libraries set the blueprints for the Robot Framework libraries. Developers choose to make an easier transition from the original libraries to RF. That is why we cannot compare the keywords from SeleniumLibrary with Browser.

I think that it was created a “wrapper” replicating SeleniumLibrary keywords using Browser.
(You can do that locally too)

I’ll note that those assertion_expected values in Browser Library are optional, you don’t have to use them, you can use the Browser Library keywords to get the value and do the assertions separately if you wish.

Dave.

4 Likes

@falcon030 You do realize that’s AI Spam bot reply ?

3 Likes