Skip to content

Improve keyboard typing and screenshot verification#6

Merged
wu-changxing merged 6 commits into
mainfrom
improve-keyboard-typing-and-screenshots
Feb 27, 2026
Merged

Improve keyboard typing and screenshot verification#6
wu-changxing merged 6 commits into
mainfrom
improve-keyboard-typing-and-screenshots

Conversation

@wu-changxing

Copy link
Copy Markdown
Contributor

Summary

  • Add keyboard_type() method for reliable typing into any element type (contenteditable support)
  • Update take_screenshot() with 1-second wait + verification guidance for full-page vs targeted screenshots
  • Add browser_config.py with browser-use anti-detection settings (53 Chrome args + 30 disabled features)
  • Remove type_text() method (replaced by keyboard_type)

Changes synced from connectonion/cli/browser_agent

  • keyboard_type() API design
  • Screenshot wait period to prevent focus loss
  • Browser config for X.com anti-detection
  • System reminders for agent guidance

Test Plan

  • Test keyboard_type() with X.com reply boxes
  • Verify screenshots don't cause focus loss
  • Confirm browser-use config works for anti-detection

🤖 Generated with Claude Code

wu-changxing and others added 6 commits February 27, 2026 14:17
- Add keyboard_type() method for reliable typing into any element type
  - Wrapper for Playwright keyboard API
  - Works with contenteditable divs (X.com, Medium, etc)
  - Returns system reminder to verify with screenshot

- Update take_screenshot() with verification guidance
  - Add 1-second wait after screenshot to prevent focus loss
  - Add full_page parameter for complete page capture
  - System reminder about full-page vs targeted screenshots
  - Explains lazy loading and detail trade-offs

- Add browser_config.py with browser-use anti-detection settings
  - 53 Chrome args for anti-bot detection
  - 30 disabled features including AutomationControlled
  - Synced from connectonion/cli/browser_agent/browser_config.py

- Remove type_text() method (replaced by keyboard_type)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
- Add wait() method for simple timeouts
- Add get_current_url() to retrieve current page URL
- Add get_current_page_html() to get page HTML content
- Add get_urls() to extract all links from page with domain filtering
- Add set_viewport() to control browser viewport size
- Add _save_context() to ensure persistent context saves properly
- Update close() to call _save_context() before cleanup
- Add __enter__/__exit__ for context manager support

These methods ensure browser-agent has feature parity with cli/browser_agent
for session persistence and utility functions.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Raw HTML is too noisy for agents. Better alternatives exist:
- get_text() for visible content
- analyze_page() for AI-powered analysis
- analyze_html() for structured analysis

Also removed from cli/browser_agent to keep both in sync.
- More descriptive name that clearly indicates it extracts links
- Also fixes indentation error from previous commit
- Renamed in both cli/browser_agent and browser-agent for sync
- Renamed tools/web_automation.py → tools/browser.py
- Updated all imports across tests, agents, and examples
- Matches connectonion's naming convention (browser.py)
- All tests passing (3/3)

This provides consistent naming across both projects:
- connectonion: cli/browser_agent/browser.py
- browser-agent: tools/browser.py
… module

Renames class and all references across tests and examples so the import
reads naturally: from tools.browser import Browser

@wu-changxing wu-changxing left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wu-changxing wu-changxing merged commit 89fc79c into main Feb 27, 2026
1 check failed
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.

1 participant