Focus Element
Browser NodeSet keyboard focus on elements for input
Overview
The Focus Element node moves keyboard focus to a specific element. This is useful before typing text, pressing keys, or interacting with elements that need focus to work properly.
SelectorThe element to focus. Use the Selector Picker for visual selection.
#search-input, .email-field, getByLabel('Username')TimeoutMaximum time to wait for the element in milliseconds
30000When to Use
Keyboard events go to the focused element. If you need to press keys (like Enter, Tab, or shortcuts) on a specific element, focus it first.
Some forms show validation messages, dropdowns, or autocomplete when an input gains focus. Use Focus to trigger these behaviors.
Test keyboard navigation by focusing elements and checking focus indicators. Useful for accessibility compliance testing.
Usage Examples
Workflow sequence:
- Focus Element: .editor-textarea
- Press Key: Key = Enter, Modifier 1 = Control
Workflow sequence:
- Focus Element: #city-input
- Wait for Element: .autocomplete-dropdown (visible)
- Fill: Type city name
Workflow sequence:
- Focus Element: #first-field
- Press Key: Tab
- Assert Element State: #second-field, Assertion Type = Is Focused
Related: Blur Element
The Blur Element node removes focus from an element. Use it to:
- Trigger blur/change events after filling a field
- Close dropdowns that appeared on focus
- Validate form fields that check input on blur