| Property |
Value
|
| Implementation Name |
Go To, Click, Fill Text
|
| Type |
API Doc
|
| Domains |
Browser_Automation, UI_Testing
|
| Workflow |
Browser_Test_Authoring
|
| Repository |
MarketSquare/robotframework-browser
|
Overview
Concrete tools for navigating to URLs and interacting with page elements provided by robotframework-browser.
Description
This set of keywords provides the fundamental navigation and interaction capabilities:
- Go To: Navigates the current page to the specified URL and waits for the page to reach the desired load state. Returns the HTTP status code of the navigation response as an integer (or 0 if none received).
- Click: Simulates a mouse click on the element matching the given selector. Performs actionability checks (visible, stable, enabled) before clicking. Supports left, middle, and right mouse buttons.
- Fill Text: Clears and fills text into an input field, textarea, or contenteditable element. Sets the value directly and triggers an
input event. Fast and reliable for standard form fields.
- Type Text: Types text character by character, sending
keydown, keypress/input, and keyup events for each character. Useful when the application responds to individual keystrokes.
All interaction keywords use strict mode by default, meaning they will fail if the selector matches multiple elements.
Usage
Use these keywords for all basic browser navigation and UI interaction. Use Go To for page navigation. Use Click for button clicks, link activation, and general element interaction. Use Fill Text for fast form filling. Use Type Text when the application requires character-by-character input (autocomplete, real-time validation, etc.).
Code Reference
Source Location
- Repository: robotframework-browser
- Files:
Browser/keywords/browser_control.py Lines 71-101 (go_to)
Browser/keywords/interaction.py Lines 304-330 (click)
Browser/keywords/interaction.py Lines 87-115 (fill_text)
Browser/keywords/interaction.py Lines 49-85 (type_text)
Signature
# Go To
def go_to(
self,
url: str,
timeout: timedelta | None = None,
wait_until: PageLoadStates = PageLoadStates.load,
) -> int
# Click
def click(
self,
selector: str,
button: MouseButton = MouseButton.left,
) -> None
# Fill Text
def fill_text(
self,
selector: str,
txt: str,
force: bool = False,
) -> None
# Type Text
def type_text(
self,
selector: str,
txt: str,
delay: timedelta = timedelta(seconds=0),
clear: bool = True,
) -> None
Import
# These are Robot Framework keywords exposed by the Browser library.
# No direct Python import is needed for typical usage.
# Robot Framework usage (in *** Settings ***):
# Library Browser
I/O Contract
Go To
| Parameter |
Type |
Default |
Description
|
url |
str |
(required) |
URL to navigate to.
|
timeout |
timedelta or None |
None |
Time to wait for page load. Uses library default if not set.
|
wait_until |
PageLoadStates |
load |
When to consider navigation complete: domcontentloaded, load, networkidle, or commit.
|
| Returns |
Description
|
| int |
HTTP status code of the navigation response, or 0 if none received.
|
Click
| Parameter |
Type |
Default |
Description
|
selector |
str |
(required) |
Selector for the element to click. Supports CSS, XPath, text, and id strategies.
|
button |
MouseButton |
left |
Mouse button to use: left, right, or middle.
|
| Returns |
Description
|
| None |
No return value.
|
Fill Text
| Parameter |
Type |
Default |
Description
|
selector |
str |
(required) |
Selector for the text field (input, textarea, or contenteditable).
|
txt |
str |
(required) |
Text to fill into the field. Empty string clears the field.
|
force |
bool |
False |
Skip Playwright actionability checks when True.
|
| Returns |
Description
|
| None |
No return value.
|
Type Text
| Parameter |
Type |
Default |
Description
|
selector |
str |
(required) |
Selector for the text field.
|
txt |
str |
(required) |
Text to type character by character.
|
delay |
timedelta |
0ms |
Delay between individual keystrokes.
|
clear |
bool |
True |
Whether to clear the field before typing.
|
| Returns |
Description
|
| None |
No return value.
|
Usage Examples
*** Settings ***
Library Browser
*** Test Cases ***
Navigate And Verify Status Code
New Page https://example.com
${status}= Go To https://example.com/about
Should Be Equal As Integers ${status} 200
Click A Button
New Page https://example.com/login
Click id=login-button
Click css=button.submit
Click text=Sign In
Click xpath=//button[@type='submit']
Fill A Login Form
New Page https://example.com/login
Fill Text id=username testuser
Fill Text id=password testpass
Click id=submit
Type Text With Delay For Autocomplete
New Page https://example.com/search
Type Text css=input.search Robot Framework delay=50ms
Fill And Type Comparison
New Page https://example.com/form
# Fill Text sets value directly (fast, single input event)
Fill Text id=email user@example.com
# Type Text simulates keystrokes (slower, per-character events)
Type Text id=username johndoe delay=10ms
Clear Field Before Typing
New Page https://example.com/form
Type Text id=search initial query
# Type new text without clearing (appends)
Type Text id=search additional clear=False
Right Click For Context Menu
New Page https://example.com
Click id=element right
Navigate With Wait Until NetworkIdle
New Page https://example.com
Go To https://example.com/dashboard wait_until=networkidle
Related Pages
Implements Principle
Page Connections
Double-click a node to navigate. Hold to expand connections.