Add webview support for Electron apps in native mode (#671)

* Add webview support for Electron apps in native mode

Fixes #580

* Fix cargo fmt violations in actions.rs and browser.rs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Revert unrelated refactors, keep only webview support changes

- Restore is_none_or (was changed to map_or unnecessarily)
- Restore single-if WebDriver check (was split into nested ifs)
- Restore simple needs_relaunch logic (was expanded into 4 branches)
- Restore find_frame signature (unused selector param was added)
- Restore flat download handler condition (was nested unnecessarily)
- Restore wait_or_kill and graceful close() to preserve cookie flushing

---------

Co-authored-by: ctate <366502+ctate@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Chris Tate
2026-03-08 17:41:40 -05:00
committed by GitHub
co-authored by ctate Claude Opus 4.6
parent 2bab729f26
commit a0bd0c2f0f
3 changed files with 39 additions and 2 deletions
+25
View File
@@ -102,6 +102,31 @@ agent-browser tab 2
agent-browser tab --url "*settings*"
```
## Webview Support
Electron `<webview>` elements are automatically discovered and can be controlled like regular pages. When using `--native` mode, webviews appear as separate targets in the tab list with `type: "webview"`:
```bash
# Connect in native mode
agent-browser --native connect 9222
# List targets -- webviews appear alongside pages
agent-browser tab
# Example output:
# 0: [page] Slack - Main Window https://app.slack.com/
# 1: [webview] Embedded Content https://example.com/widget
# Switch to a webview
agent-browser tab 1
# Interact with the webview normally
agent-browser snapshot -i
agent-browser click @e3
agent-browser screenshot webview.png
```
**Note:** Webview support requires `--native` mode (raw CDP). The Playwright-based mode does not support webview targets.
## Common Patterns
### Inspect and Navigate an App