close

How to fix selenium “DevToolsActivePort file doesn’t exist” exception in Python

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to fix selenium “DevToolsActivePort file doesn’t exist” exception in Python in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to fix selenium “DevToolsActivePort file doesn’t exist” exception in Python?

  1. How to fix selenium “DevToolsActivePort file doesn't exist” exception in Python?

    I solve it by adding an argument --remote-debugging-port=<port>
    chromeOptions = webdriver.ChromeOptions() chromeOptions.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2})

  2. fix selenium “DevToolsActivePort file doesn't exist” exception in Python

    I solve it by adding an argument --remote-debugging-port=<port>
    chromeOptions = webdriver.ChromeOptions() chromeOptions.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2})

Method 1

I solve it by adding an argument --remote-debugging-port=<port>

chromeOptions = webdriver.ChromeOptions() 
chromeOptions.add_experimental_option("prefs", {"profile.managed_default_content_settings.images": 2}) 
chromeOptions.add_argument("--no-sandbox") 
chromeOptions.add_argument("--disable-setuid-sandbox") 

chromeOptions.add_argument("--remote-debugging-port=9222")  # this

chromeOptions.add_argument("--disable-dev-shm-using") 
chromeOptions.add_argument("--disable-extensions") 
chromeOptions.add_argument("--disable-gpu") 
chromeOptions.add_argument("start-maximized") 
chromeOptions.add_argument("disable-infobars")
chromeOptions.add_argument(r"user-data-dir=.\cookies\\test") 

b = webdriver.Chrome(chrome_options=chromeOptions) 
b.get("https://google.com/") 
b.quit()

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read