Hi everyone,
I’ve been working extensively with Browser Library and noticed a pattern that I think is worth discussing with the community.
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:
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.
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.
Suggestions
- Split responsibilities:
- Keep Get Text, Get Title, etc., as pure getters.
- Introduce separate assertion keywords like Text Should Be, Title Should Be, etc.
- Rename overloaded keywords:
- If combining retrieval and validation is necessary, use names like Validate Text, Assert Title, etc.
- Improve documentation clarity:
- Clearly highlight when a keyword performs assertions based on optional arguments.
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!