Add Chrome for Testing support for reliable WebDriver automation

- Add setup script (scripts/setup-chrome-for-testing.sh) that downloads
  matching Chrome and ChromeDriver versions from Google's CDN
- Add chrome_binary config option to specify custom Chrome binary path
- Update ChromeDriver to support custom binary via with_port_headless_and_binary()
- Update README with Chrome for Testing setup instructions
- Update config.example.toml with chrome_binary documentation

Chrome for Testing is Google's dedicated browser for automated testing
that guarantees version compatibility with ChromeDriver, avoiding the
common 'version mismatch' errors when Chrome auto-updates.
This commit is contained in:
Dhanji R. Prasanna
2025-12-15 17:02:30 +11:00
parent d142cdfffe
commit 81cba42c8d
6 changed files with 165 additions and 3 deletions

View File

@@ -273,11 +273,25 @@ g3 --webdriver
g3 --webdriver --safari
```
**Chrome Headless Setup**: Install ChromeDriver:
**Chrome Setup Options**:
*Option 1: Use Chrome for Testing (Recommended)* - Guarantees version compatibility:
```bash
./scripts/setup-chrome-for-testing.sh
```
Then add to your `~/.config/g3/config.toml`:
```toml
[webdriver]
chrome_binary = "/Users/yourname/.chrome-for-testing/chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing"
```
*Option 2: Use system Chrome* - Requires matching ChromeDriver version:
- macOS: `brew install chromedriver`
- Linux: `apt install chromium-chromedriver`
- Or download from: https://chromedriver.chromium.org/downloads
**Note**: If you see "ChromeDriver version doesn't match Chrome version" errors, use Option 1 (Chrome for Testing) which bundles matching versions.
## macOS Accessibility API Tools
G3 includes support for controlling macOS applications via the Accessibility API, allowing you to automate native macOS apps.