Appearance
Selenium Automation
Connect Selenium WebDriver to Multilogin X browser profiles for automated testing and scraping.
Starting a Profile with Selenium
Start a browser profile with automation_type=selenium to receive a local port for WebDriver connection.
bash
curl "https://launcher.mlx.yt:45001/api/v1/profile/f/FOLDER_ID/p/PROFILE_ID/start?automation_type=selenium" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Accept: application/json"Response:
json
{
"status": {
"error_code": "",
"http_code": 200,
"message": "54499"
}
}The message field contains the Selenium port (e.g., 54499).
Connecting with Python Selenium
python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
# Port from the start response
selenium_port = 54499
# Connect to the running profile
options = Options()
driver = webdriver.Remote(
command_executor=f"http://127.0.0.1:{selenium_port}",
options=options
)
# Now automate
driver.get("https://example.com")
print(driver.title)
# When done, close the connection (profile stays open)
driver.quit()Full Automation Flow
Script Runner with Selenium
You can also use the Script Runner to execute Selenium scripts across multiple profiles simultaneously:
- Start profiles with
automation_type=selenium - Use
POST /api/v1/run_scriptto run your Python script on active profiles - Profiles remain open after script execution
See Script Runner for details.
Headless Mode
Run Selenium automation without a visible browser window:
bash
curl "https://launcher.mlx.yt:45001/api/v1/profile/f/FOLDER_ID/p/PROFILE_ID/start?automation_type=selenium&headless_mode=true" \
-H "Authorization: Bearer YOUR_TOKEN"Best Practices
- Always handle the Selenium port dynamically from the API response
- Use explicit waits (
WebDriverWait) rather thantime.sleep() - Close WebDriver connections with
driver.quit()when done - Stop profiles via the API when automation is complete
- Use headless mode for server-side automation