-
Notifications
You must be signed in to change notification settings - Fork 79
Description
Issue Description
Unable to launch browsers using the start_browser function in the selenium-mcp environment. Multiple browser configurations attempted, all resulting in errors.
Environment
- Date: April 15, 2025
- Environment: selenium-mcp
- Function called:
start_browser
Steps to Reproduce
- Call the
start_browserfunction with Chrome configuration - Attempt alternative Chrome configuration with additional arguments
- Try Firefox as fallback option
Observed Behavior
All browser launch attempts fail with different errors:
Attempt 1: Chrome Default
{ browser: chrome, options: { headless: false } }
Error starting browser: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
Attempt 2: Chrome with No Sandbox
{ browser: chrome, options: { headless: false, arguments: [ --no-sandbox, --disable-dev-shm-usage ] } }
Error starting browser: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
Attempt 3: Firefox
{ browser: firefox, options: { headless: false } }
Error starting browser: Failed to start browser /root/.cache/selenium/firefox/linux64/137.0.1/firefox: IO Error: No such file or directory (os error 2)
Expected Behavior
At least one of the browser configurations should successfully launch a browser instance that can be used for testing.
Impact
Unable to execute Selenium automated tests in this environment, blocking test execution capabilities.
Possible Causes
-
Chrome: User data directory conflicts, possibly due to:
- Previous sessions not properly terminated
- Parallel test execution conflicts
- Missing unique user data directory configuration
-
Firefox: Binary not found or not properly installed at the expected location:
- Firefox binary missing from
/root/.cache/selenium/firefox/linux64/137.0.1/firefox - Permissions issues with the Firefox binary
- Firefox binary missing from
Suggested Solutions
-
For Chrome:
- Add automatic user-data-dir argument with a unique value (timestamp-based)
- Add automatic cleanup of orphaned Chrome processes
- Implement automatic retry with incremental unique directories
-
For Firefox:
- Ensure proper installation of Firefox binary
- Add better error handling for missing binaries
- Implement automatic download of Firefox if missing
Additional Information
This issue is blocking all Selenium test execution in the environment. Any workarounds or immediate fixes would be greatly appreciated.
Reproducible Test Case
// Simple test case that reproduces the issue
function testBrowserLaunch() {
// Attempt 1: Chrome
try {
browser = await start_browser({ browser: "chrome", options: { headless: false }});
console.log("Chrome launched successfully");
} catch (error) {
console.error("Chrome launch failed:", error);
// Attempt 2: Chrome with additional arguments
try {
browser = await start_browser({
browser: "chrome",
options: {
headless: false,
arguments: ["--no-sandbox", "--disable-dev-shm-usage"]
}
});
console.log("Chrome with arguments launched successfully");
} catch (error) {
console.error("Chrome with arguments launch failed:", error);
// Attempt 3: Firefox
try {
browser = await start_browser({ browser: "firefox", options: { headless: false }});
console.log("Firefox launched successfully");
} catch (error) {
console.error("Firefox launch failed:", error);
}
}
}
}Thank you for your attention to this issue.
additional info: my claude-desktop-config.json file
{
"mcpServers": {
"mobile-mcp": {
"command": "npx",
"args": [
"-y",
"@mobilenext/mobile-mcp@latest"
]
},
"mcp-selenium": {
"command": "npx",
"args": [
"-y",
"@smithery/cli@latest",
"run",
"@angiejones/mcp-selenium"
]
}
}
}