Skip to content

feat(browser): add system browser detection for Playwright #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ export default {
userSession: false,
pageFilter: 'none', // 'simple', 'none', or 'readability'

// System browser detection settings
browser: {
// Whether to use system browsers or Playwright's bundled browsers
useSystemBrowsers: true,

// Preferred browser type (chromium, firefox, webkit)
preferredType: 'chromium',

// Custom browser executable path (overrides automatic detection)
// executablePath: null, // e.g., '/path/to/chrome'
},

// Model settings
provider: 'anthropic',
model: 'claude-3-7-sonnet-20250219',
Expand Down Expand Up @@ -209,6 +221,43 @@ MyCoder follows the [Conventional Commits](https://www.conventionalcommits.org/)

For more details, see the [Contributing Guide](CONTRIBUTING.md).

## Browser Automation

MyCoder uses Playwright for browser automation, which is used by the `sessionStart` and `sessionMessage` tools. By default, Playwright requires browsers to be installed separately via `npx playwright install`.

### System Browser Detection

MyCoder now includes a system browser detection feature that allows it to use your existing installed browsers instead of requiring separate Playwright browser installations. This is particularly useful when MyCoder is installed globally.

The system browser detection:

1. Automatically detects installed browsers on Windows, macOS, and Linux
2. Supports Chrome, Edge, Firefox, and other browsers
3. Maintains headless mode and clean session capabilities
4. Falls back to Playwright's bundled browsers if no system browser is found

### Configuration

You can configure the browser detection in your `mycoder.config.js`:

```js
export default {
// Other configuration...

// System browser detection settings
browser: {
// Whether to use system browsers or Playwright's bundled browsers
useSystemBrowsers: true,

// Preferred browser type (chromium, firefox, webkit)
preferredType: 'chromium',

// Custom browser executable path (overrides automatic detection)
// executablePath: null, // e.g., '/path/to/chrome'
},
};
```

## Contributing

Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to this project.
Expand Down
Loading
Loading