• Website
  • Server status
  • API documentation
  • Blog
Telegram Icon Community
EN
English
Português
Русский
中文 (中国)
Tiếng Việt
Log in Try for €3.99
  • Website
  • Server status
  • API documentation
  • Blog
  • Telegram Icon Community
  • English (US)
    English
    Português
    Русский
    中文 (中国)
    Tiếng Việt
Log in View Plans

Puppeteer, Selenium, and Playwright

Control browser profiles programmatically with Puppeteer, Selenium, and Playwright. Automate web interactions, scraping, and profile management at scale.

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Getting started with Multilogin X automation
  • Basic automation with CLI
  • Low-code automation with Postman
  • Script runner & predefined scripts
  • Puppeteer, Selenium, and Playwright
  • Custom API scripts with Python
  • Quick solutions in Developer Tools
  • Home
  • Multilogin X
  • Task automation with API
  • Puppeteer, Selenium, and Playwright
  • Selenium automation example

Selenium automation example

Written by Jason N ( Updated on April 9th, 2025 )

Updated on April 9th, 2025

This simple automation script in Python uses the Selenium library to manipulate a profile in Multilogin X. It performs the following actions:

  1. Sign in using Multilogin X API
  2. Start the profile defining Selenium as the selected automation type
  3. Retrieve the port used by the running profile
  4. Start a Selenium driver on localhost using the retrieved port
  5. Use the driver to manipulate browser actions
  6. Stop the profile in 5 seconds

Before you start

  1. Install the following Python libraries:
    1. requests
    2. selenium
  2. Insert your values into the below variables in the script:
    1. USERNAME: your Multilogin X account email
    2. PASSWORD: your Multilogin X account password (MD5 encryption is not required)
    3. FOLDER_ID, PROFILE_ID: find these values using our guides on DevTools or Postman

Running the script

  1. Make sure the agent is connected, as it makes profile launching possible
  2. By default, the script below works for Mimic. To use it for Stealthfox, replace options=ChromiumOptions() with options=Options() in the following line:
    driver = webdriver.Remote(command_executor=f'{LOCALHOST}:{selenium_port}', options=ChromiumOptions()) 
  3. Run the .py file with your automation code

Script example

import requests
import hashlib
import time
from selenium import webdriver
from selenium.webdriver.chromium.options import ChromiumOptions
from selenium.webdriver.firefox.options import Options

MLX_BASE = "https://api.multilogin.com"
MLX_LAUNCHER = "https://launcher.mlx.yt:45001/api/v1"
MLX_LAUNCHER_V2 = (
    "https://launcher.mlx.yt:45001/api/v2"  # recommended for launching profiles
)
LOCALHOST = "http://127.0.0.1"
HEADERS = {"Accept": "application/json", "Content-Type": "application/json"}
# TODO: Insert your account information in both variables below
USERNAME = ""
PASSWORD = ""
# TODO: Insert the Folder ID and the Profile ID below
FOLDER_ID = ""
PROFILE_ID = ""


def signin() -> str:
    payload = {
        "email": USERNAME,
        "password": hashlib.md5(PASSWORD.encode()).hexdigest(),
    }
    r = requests.post(f"{MLX_BASE}/user/signin", json=payload)
    if r.status_code != 200:
        print(f"\nError during login: {r.text}\n")
    else:
        response = r.json()["data"]
    token = response["token"]
    return token


def start_profile() -> webdriver:
    r = requests.get(
        f"{MLX_LAUNCHER_V2}/profile/f/{FOLDER_ID}/p/{PROFILE_ID}/start?automation_type=selenium",
        headers=HEADERS,
    )
    response = r.json()
    if r.status_code != 200:
        print(f"\nError while starting profile: {r.text}\n")
    else:
        print(f"\nProfile {PROFILE_ID} started.\n")
    selenium_port = response["data"]["port"]
    driver = webdriver.Remote(
        command_executor=f"{LOCALHOST}:{selenium_port}", options=ChromiumOptions()
    )
    # For Stealthfox profiles use: options=Options()
    # For Mimic profiles use: options=ChromiumOptions()
    return driver


def stop_profile() -> None:
    r = requests.get(f"{MLX_LAUNCHER}/profile/stop/p/{PROFILE_ID}", headers=HEADERS)
    if r.status_code != 200:
        print(f"\nError while stopping profile: {r.text}\n")
    else:
        print(f"\nProfile {PROFILE_ID} stopped.\n")


token = signin()
HEADERS.update({"Authorization": f"Bearer {token}"})
driver = start_profile()
driver.get("https://multilogin.com/")
time.sleep(5)
stop_profile()
 
 

Video guide

Your browser does not support HTML5 video.
automation selenium selenium example code example selenium script api

Was this article helpful?

Give feedback about this article

In this article

  • Before you start
  • Running the script
  • Video guide

Multilogin community

Stay informed, share your thoughts, and engage with others!

Join us on Telegram

Read more on the topic

blogpost img

10 Best Datacenter Proxies for Web Scraping (2025 Edition)

Apr 2, 2025 5 min read
Google SERP Img

What is a Google SERP Proxy and Why Should You Care?

Apr 1, 2025 6 min read
UK Proxy Img

What Are Dedicated UK Proxies? Everything You Need to Know

Apr 1, 2025 6 min read
art-icon

Related Articles

  • How to get API tokens in DevTools
  • How to get IDs in DevTools
  • How to set up Multilogin X API with Postman
  • How to find a user ID in DevTools

ANTIDETECT PLATFORM

  • Antidetect browser
  • Mobile antidetect browser
  • Headless browser
  • Multilogin residential proxies
  • Multi-account management
  • Web automation

RESOURCES

  • Knowledge base
  • API documentation
  • Glossary
  • Blog
  • Multilogin 6 download
  • Server status
  • Release notes

PLATFORM PROXIES

  • Google proxy
  • Facebook proxy
  • Reddit proxy
  • Twitter proxy
  • Amazon proxy
  • LinkedIn proxy

GEO PROXIES

  • Japan proxy
  • UK proxy
  • USA proxy
  • China proxy
  • Canada proxy
  • India proxy

MULTI-ACCOUNT MANAGEMENT

  • Create multiple Facebook accounts
  • Create multiple LinkedIn accounts
  • Create multiple Amazon accounts
  • Create multiple eBay accounts
  • Create multiple Gmail accounts
  • Create multiple Discord accounts

COMPARISON

  • Multilogin vs. Gologin
  • Multilogin vs. Adspower
  • Multilogin vs. Dolphin Anty
  • Multilogin vs. Incognition
  • Multilogin vs. Octo Browser

GET IN TOUCH

  • Contact 24/7 support
    [email protected]
  • Contact sales
  • Affiliate program
  • Careers

© 2025 Multilogin. All rights reserved.

  • Privacy policy
  • Terms of service
  • Cookie policy
  • ANTIDETECT PLATFORM

    • Antidetect browser
    • Mobile antidetect browser
    • Headless browser
    • Multilogin residential proxies
    • Multi-account management
    • Web automation
  • RESOURCES

    • Knowledge base
    • API documentation
    • Glossary
    • Blog
    • Multilogin 6 download
    • Server status
    • Release notes
  • MULTI-ACCOUNT MANAGEMENT

    • Create multiple Facebook accounts
    • Create multiple LinkedIn accounts
    • Create multiple Amazon accounts
    • Create multiple eBay accounts
    • Create multiple Gmail accounts
    • Create multiple Discord accounts
  • COMPARISON

    • Multilogin vs. Gologin
    • Multilogin vs. Adspower
    • Multilogin vs. Dolphin Anty
    • Multilogin vs. Incognition
    • Multilogin vs. Octo Browser
  • PLATFORM PROXIES

    • Google proxy
    • Facebook proxy
    • Reddit proxy
    • Twitter proxy
    • Amazon proxy
    • LinkedIn proxy
  • GEO PROXIES

    • Japan proxy
    • UK proxy
    • USA proxy
    • China proxy
    • Canada proxy
    • India proxy
  • GET IN TOUCH

    • 24/7 support: [email protected]
    • Contact sales
    • Affiliate program
    • Careers
  • Privacy policy
  • Terms of service
  • Cookie policy

© 2025 Multilogin. All rights reserved.

Expand