Repository navigation
Add a desktop target to xcrs over WebDriver - #122
Conversation
SelectedTarget::Desktop, selected with device_select webdriver_url, drives an app through tauri-driver or any WebDriver endpoint using reqwest and plain JSON. app_install_launch and app_launch start a session, ui_describe returns the page source, ui_element_list and ui_tap work on labelled elements, input_text types into the focused element, and screen_capture returns a PNG. The other tools return an error saying they have no desktop meaning, and the 21-tool list is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: siGit Code v1.7.6 <noreply@sigit.si>
There was a problem hiding this comment.
Adds a Desktop variant to SelectedTarget selected by a new webdriver_url field on device_select/device_capabilities, plus a hand-rolled W3C WebDriver client (webdriver.rs) that maps seven of the 21 tools onto a tauri-driver session: launch tools create the session (which starts the app), terminate deletes it, describe/elements/tap/text/screenshot run against it. resolve_target is the new general resolver; resolve_selected_target keeps its old signature. The macro dispatches desktop targets before the per-platform matches, and every other tool returns a no-desktop-meaning error. Tests cover the resolver, a stub WebDriver server, and error mapping.
Main things to look at: the input_text body shape (see finding — tauri-driver currently drops the W3C text field, so typing may fail against a real driver), the app_install_launch desktop branch that only fires when the stored target is desktop and silently ignores an explicitly passed Apple field, and the session map keyed by base URL with no validation that the session still exists server-side.
Automated review by siGit Code Review · commit 0315b46 · see the review dashboard
…letes, show raw error bodies Element Send Keys now carries both text and the legacy value array, a failed session delete keeps the id so app_terminate can retry, a non-JSON error body is included in the message, and the capability probe times out after two seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: siGit Code v1.7.6 <noreply@sigit.si>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: siGit Code v1.7.6 <noreply@sigit.si>
There was a problem hiding this comment.
The diff tightens the WebDriver client: error responses now keep non-object bodies, /status probes are capped at 2s, end_session deletes before forgetting the session so app_terminate can retry, and type_text sends both the W3C text and legacy value arrays. The added tests cover those paths. One edge remains: a JSON object returned by a proxy rather than by WebDriver is still trusted and its body discarded, so the error loses the clue.
The earlier send-keys, delete-retry, raw-body, and 60s-status-probe findings are addressed; the start_session failure-swallowing concern is unchanged and still open.
Automated review by siGit Code Review · commit 3a2b851 · changes since 0315b46 · see the review dashboard
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: siGit Code v1.7.6 <noreply@sigit.si>
There was a problem hiding this comment.
Re-review of the delta since 3a2b851: the error-shape fix in webdriver.rs now trusts a body as WebDriver JSON only when value.error is a string, so a valid-JSON-but-wrong-shape reply like {"message":"no healthy upstream"} falls through to the raw-body branch and its text is kept — exactly as agreed in the earlier thread, and a test covers it. The non-object case still lands in the body branch because value defaults to Null. All previously raised threads (send-keys shape, session delete ordering, driver_ready probe timeout, argument naming, formatting) remain addressed or closed as before; nothing new to flag.
Automated review by siGit Code Review · commit 571acdb · changes since 3a2b851 · see the review dashboard
Adds a desktop target to
xcrs, so an agent can drive a Tauri app on Linux throughtauri-driver(WebKitWebDriver) with the same MCP tools it uses on mobile.device_selectanddevice_capabilitiestakewebdriver_url.SelectedTarget::Desktopis a new variant, andresolve_targetrejectswebdriver_urlcombined with any Apple or Android field.resolve_selected_targetkeeps its signature.crates/xcrs/src/webdriver.rsis a W3C WebDriver client over the existingreqwestdependency, with no client library. It speaks the same protocol as thee2e/binary/smoke.mjsscript in sigit-app.app_install_launchandapp_launchstart a session (which launches the binary),app_terminateends it,ui_describereturns the page source,ui_element_listreturns visible interactive elements (capped at 200),ui_tapclicks the one displayed element matching an id, name, test id, ARIA label, title or text,input_texttypes into the focused element,screen_capturereturns a PNG.tauri-driverlaunches the app when the session is created.Tests:
cargo test -p xcrs(95 lib tests, including a stub WebDriver server for session, source, screenshot, click, ambiguous and missing matches, typing, the element cap and error mapping),cargo clippy -p xcrs --all-targetsandcargo fmt --checkare clean on macOS. I have not run it against a realtauri-driveryet.