ui_set_focus
Set keyboard focus to a UI element using automation ID, name, or other locators. Ensures subsequent key input reaches the correct target.
Instructions
Set keyboard focus to a UI element.
Uses UIA-based Focus() for FlaUI backend (monitor/DPI-agnostic), or element search + set_focus for pywinauto backend.
Call this before ui_send_keys to ensure keys go to the right element.
Args: automation_id: AutomationId property (FlaUI + pywinauto) name: Element's Name/Title property (FlaUI + pywinauto) control_type: Control type (pywinauto only) root_id: Optional AutomationId to scope search (pywinauto only) xpath: Optional XPath expression (pywinauto only)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| automation_id | No | ||
| name | No | ||
| control_type | No | ||
| root_id | No | ||
| xpath | No |