Skip to content

fix: prevent Chrome auto-launch when iOS provider is active#1222

Open
jin-2-kakaoent wants to merge 3 commits intovercel-labs:mainfrom
hyunjinee:fix/ios-provider-chrome-auto-launch
Open

fix: prevent Chrome auto-launch when iOS provider is active#1222
jin-2-kakaoent wants to merge 3 commits intovercel-labs:mainfrom
hyunjinee:fix/ios-provider-chrome-auto-launch

Conversation

@jin-2-kakaoent
Copy link
Copy Markdown
Contributor

@jin-2-kakaoent jin-2-kakaoent commented Apr 12, 2026

Summary

Fixes #1221

When using -p ios, Chrome was silently auto-launched alongside the iOS Safari WebDriver backend. All commands (navigate, click, eval, wait) were routed through Chrome instead of iOS Safari, creating a parity gap where the agent couldn't interact with the real iOS page.

Root causes and fixes:

  • Chrome auto-launch bypass: needs_launch check in execute_command only looked at state.browser (CDP), ignoring state.webdriver_backend. Now checks state.webdriver_backend.is_none() before triggering auto-launch.
  • handle_wait CDP-only: All wait variants (selector, text, url, function) failed with "Browser not launched" on WebDriver backends. Unified via poll_until_true router that dispatches to cdp_poll_until_true or webdriver_poll_until_true based on active backend.
  • --device flag not forwarded: Launch command JSON didn't include deviceName, so launch_ios couldn't read the user's device selection. Now passed through in main.rs with env var fallback via resolve_ios_device_name.
  • WebDriver return missing: W3C WebDriver /execute/sync treats scripts as function bodies requiring explicit return. Polling expressions now wrapped with return.
  • JS expression duplication: Extracted selector_check_js, text_check_js, url_check_js, function_check_js as shared pure functions used by both CDP and WebDriver paths.

Test plan

  • test_webdriver_backend_skips_auto_launch — verifies Chrome is not auto-launched when WebDriver backend is active
  • test_webdriver_wait_timeout_without_cdp — timeout wait works without CDP browser
  • test_webdriver_wait_selector_without_cdp — selector wait uses WebDriver polling path
  • test_resolve_ios_device_name_env_fallback — env var fallback for device name
  • test_resolve_ios_device_name_cmd_takes_priority — cmd JSON takes priority over env var
  • Full test suite: 627 passed, 0 failed, 0 regressions

…abs#1221)

When using `-p ios`, Chrome was silently auto-launched alongside the
iOS Safari WebDriver backend, routing all commands through Chrome instead
of the intended iOS Safari session.

- Skip auto-launch when `webdriver_backend` is already active
- Add WebDriver polling path to `handle_wait` via unified `poll_until_true` router
- Extract shared JS expression builders (`selector_check_js`, etc.) for CDP/WebDriver
- Pass `--device` flag through to daemon launch command
- Add `resolve_ios_device_name`/`resolve_ios_device_udid` with env var fallback
- Fix WebDriver `execute/sync` requiring explicit `return` in poll expressions
- Improve `loadState` error message for WebDriver backends

Closes vercel-labs#1221
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Apr 12, 2026

@hyunjinee is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

After handle_wait was refactored to use the unified poll_until_true
router, wait_for_text became the only wait helper with no remaining
callers. The other helpers (wait_for_selector, wait_for_url,
wait_for_function) are still used by dedicated handle_waitfor* handlers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS provider opens local Next dev route but never exposes mounted page selectors

2 participants