Forms & Inputs in QWeb
Form handling is the most common automation task.
QWeb simplifies this using Smart Locators, which associate visible text, placeholders, and attributes with their corresponding input fields.
The guiding principle:
Interact with inputs like a user would — not by inspecting DOM structure.
1. Standard Text Fields (TypeText)
TypeText is the primary keyword for entering text into input fields.
QWeb automatically resolves the correct input field using:
- Placeholder text
- Closest visible label
- Attribute values (
id,name,title, etc.) of an input element - Direct XPath (when prefixed with
xpath=or//)
Examples:
TypeText First Name John
TypeText Search... Robot Framework
TypeText submit-query Robot Framework
TypeText xpath\=//input[@name='q'] Robot Framework
2. Default Typing Behavior
QWeb simulates realistic form interaction, not just raw keystrokes.
2.1 Field Is Cleared by Default
Before typing, QWeb clears the field automatically.
This ensures:
- Old values are removed
- No leftover characters remain
- Tests remain deterministic
Override per keyword:
Override globally:
2.2 Automatic TAB After Typing
By default, QWeb sends a TAB after typing to move focus to the next field.
This triggers:
- OnBlur validation
- Auto-save logic
- Field formatting
- Client-side validation
This setting can be changed globally:
Use this carefully, as some applications rely on blur events.
3. Special Characters in Typed Text
QWeb interprets certain escape sequences inside the typed string.
\n — New Line (Enter)
Equivalent to pressing Enter between lines.
Useful for: - Textareas - Chat inputs - Submitting forms via Enter
\t — Tab Key
Simulates pressing the TAB key explicitly.
Note:
- QWeb already sends TAB by default (unless disabled).
- Use
\tonly when explicit control is required.
4. Sensitive Data (TypeSecret)
Never use TypeText for passwords or secrets.
Why?
- Value is masked in Robot logs
- Prevents credentials from appearing in reports
5. Verifying Input State
VerifyInputValue
Ensures the field contains the expected value.
GetInputValue
Reads the current value.
Useful for:
- Comparing before/after changes
- Extracting generated IDs
- Validating computed fields
VerifyInputStatus
Checks whether the field is interactable.
VerifyInputElement
Confirms the input exists.
6. Ambiguous Forms
If multiple inputs share the same label:
Anchors restrict search context.
7. Directional Search Strategy (SetConfig)
In structured layouts (for example, labels always above inputs):
SetConfig SearchDirection down
TypeText First Name John
TypeText Last Name Doe
SetConfig SearchDirection closest
Available directions:
closest(default)updownleftrightup!down!left!right!
Strict Mode
Search modes ending with ! enable Strict Mode. In strict mode, the element must be found exactly in the specified direction. If not found there, the search fails. No fallback matching is performed. Strict mode applies only to text-based searches (e.g. VerifyText, ClickText).
8. Hidden or Dynamic Inputs
QWeb interacts with visible elements by default.
If necessary:
Use cautiously — hidden inputs are typically not user-interactable.
9. Related Input Keywords
| Keyword | Purpose |
|---|---|
TypeText |
Enter text into input fields |
TypeSecret |
Enter masked sensitive data |
VerifyInputValue |
Verify current value |
GetInputValue |
Retrieve value |
VerifyInputStatus |
Check enabled/disabled state |
VerifyInputElement |
Confirm input exists |
Design Principles
- Prefer visible text over XPath.
- Let QWeb handle field state instead of manual DOM assertions.
- Keep default clearing and TAB behavior unless you have a reason to change it.
- Validate behavior, not HTML implementation.
- Use
TypeSecretfor anything sensitive.