dont run safaridriver --enable each time
This commit is contained in:
24
README.md
24
README.md
@@ -132,6 +132,30 @@ cargo run
|
|||||||
g3 "implement a function to calculate fibonacci numbers"
|
g3 "implement a function to calculate fibonacci numbers"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## WebDriver Browser Automation
|
||||||
|
|
||||||
|
G3 includes WebDriver support for browser automation tasks using Safari.
|
||||||
|
|
||||||
|
**One-Time Setup** (macOS only):
|
||||||
|
|
||||||
|
Safari Remote Automation must be enabled before using WebDriver tools. Run this once:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Option 1: Use the provided script
|
||||||
|
./scripts/enable-safari-automation.sh
|
||||||
|
|
||||||
|
# Option 2: Enable manually
|
||||||
|
safaridriver --enable # Requires password
|
||||||
|
|
||||||
|
# Option 3: Enable via Safari UI
|
||||||
|
# Safari → Preferences → Advanced → Show Develop menu
|
||||||
|
# Then: Develop → Allow Remote Automation
|
||||||
|
```
|
||||||
|
|
||||||
|
**For detailed setup instructions and troubleshooting**, see [WebDriver Setup Guide](docs/webdriver-setup.md).
|
||||||
|
|
||||||
|
**Usage**: Run G3 with the `--webdriver` flag to enable browser automation tools.
|
||||||
|
|
||||||
## Computer Control (Experimental)
|
## Computer Control (Experimental)
|
||||||
|
|
||||||
G3 can interact with your computer's GUI for automation tasks:
|
G3 can interact with your computer's GUI for automation tasks:
|
||||||
|
|||||||
@@ -3070,23 +3070,9 @@ Template:
|
|||||||
}
|
}
|
||||||
drop(session_guard);
|
drop(session_guard);
|
||||||
|
|
||||||
// Check if Safari Remote Automation is enabled
|
// Note: Safari Remote Automation must be enabled before using WebDriver.
|
||||||
let check_enabled = tokio::process::Command::new("safaridriver")
|
// Run this once: safaridriver --enable
|
||||||
.arg("--enable")
|
// Or enable manually: Safari → Develop → Allow Remote Automation
|
||||||
.output()
|
|
||||||
.await;
|
|
||||||
|
|
||||||
match check_enabled {
|
|
||||||
Ok(output) if !output.status.success() => {
|
|
||||||
return Ok("❌ Safari Remote Automation is not enabled.\n\nTo enable it (one-time setup):\n 1. Run: safaridriver --enable\n 2. Enter your password when prompted\n 3. Try again\n\nAlternatively, enable it manually:\n Safari → Develop → Allow Remote Automation".to_string());
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
return Ok(format!("❌ Failed to check Safari automation status: {}\n\nMake sure safaridriver is installed (it comes with macOS).", e));
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
debug!("Safari Remote Automation is enabled");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start safaridriver process
|
// Start safaridriver process
|
||||||
let port = self.config.webdriver.safari_port;
|
let port = self.config.webdriver.safari_port;
|
||||||
@@ -3126,7 +3112,7 @@ Template:
|
|||||||
// Kill the safaridriver process if connection failed
|
// Kill the safaridriver process if connection failed
|
||||||
let _ = safaridriver_process.kill().await;
|
let _ = safaridriver_process.kill().await;
|
||||||
|
|
||||||
Ok(format!("❌ Failed to connect to SafariDriver: {}\n\nThis might be because:\n - Port {} is already in use\n - Safari failed to start\n - Network connectivity issue\n\nTry a different port or check if another safaridriver is running.", e, port))
|
Ok(format!("❌ Failed to connect to SafariDriver: {}\n\nThis might be because:\n - Safari Remote Automation is not enabled (run: safaridriver --enable)\n - Port {} is already in use\n - Safari failed to start\n - Network connectivity issue\n\nTo enable Remote Automation:\n 1. Run: safaridriver --enable (requires password, one-time setup)\n 2. Or manually: Safari → Develop → Allow Remote Automation", e, port))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user