Share it on social media

Table of contents

Published: May 25, 2022 Last modified: June 14, 2022

LUCD: How to create undetectable Selenium Chrome driver | Python

Create Local Undetectable Chrome Driver (LUCD)

This program will download a Chrome driver that you can use for your Python Selenium code.


    • Download the exact chrome driver based on your OS and installed chrome version automatically.
      • Remove browser control flag.
        • Remove signature in JavaScript.
          • Set User-Agent.
            • Use maximum resolution.
            • Open Chrome instance through debugging mode.
            • Control an existing Chrome instance.
            • Save/load Chrome profiles


            $ pip install lucd 


            $ pip install git+


            from lucd.driver import Driver
            driver = Driver()
            chrome = driver.create_driver()


            Load Profile

            Launch Chrome with its default or custom profile so that you can use cookies and site preferences from that profile.

            chrome = driver.create_driver(profile_path="")

            Note: Make sure to provide the absolute path of your profile

            To find path to your chrome profile data you need to type chrome://version/ into address bar .


            To mute the browser in case you'll watch some videos, you can enable the mute attribute.

            chrome = driver.create_driver(mute=True)

            Use debugging mode

            if you want to launch your selenium Chrome webdriver from an existing session, there are three attributes you can change:

            • debugging
            • default_profile
            • debug_port

            If you set debugging to True this way:

            chrome = driver.create_driver(debugging=True)

            The function create_driver will launch another terminal that will open a new Chrome session on the debugging mode on a given port (9222 is the default).

            If you keep default_profile False (default), it will open a new session on a new profile (profile folder will be saved in your working directory).

            Otherwise, you can you can choose your Chrome default profile by setting default_profile to True.

            And to use a custom profile, put the its path in profile_path, and make sure to use the absolute path.

            Finally, if you will open multiple sessions, it's better to change the port on each session:

            chrome = driver.create_driver(debugging=True, debug_port=9220, profile_path="path_to_a_profile_where_i_can_open_my_gmail")

            The example above will open a new Chrome session on the port 9220 on the debugging mode on the given profile to use my Gmail account.

            What if I want to control an existing Chrome instance?

            Let's say you already opened a Chrome instance through one of these commands:


            start chrome.exe --remote-debugging-port=8888

            Linux/ Mac

            /usr/bin/google-chrome --remote-debugging-port=8888 

            Then you can control the created Chrome instance using the control_existing_instance attribute:

            chrome = driver.create_driver(debugging=True, debug_port=8888, profile_path="path_to_a_profile_where_i_can_open_my_gmail", control_existing_instance=True)

            > Make sure to use the correct port number.


            We can use a headless chrome browser to lower memory overhead and faster execution for the scripts that we write.

            chrome = driver.create_driver(headless=False)

            435 0

            This is Selmi Abderrahim, the author and the admin of SelmiTech blog.

            Subscribe to our mail list

            No comments yet!