I used to be able to run several instances of Chrome concurrently without issue. After a DevToolsTools active port file doesn't exist error popped up, the only solution that seemed to get things up and running was options.add_argument('--remote-debugging-port=9222')
. However, since I have added that, I can no longer run concurrent or even sequential instances of the automated browser. Running the code below, I will get this error when browser2 tries to start:
(chrome not reachable) (The process started from chrome location C:\Program Files\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
When I try to start a any browser instance with an existing one running I get the text:
Opening in existing browser session.
Chrome never tried to get into a existing session I added the options.add_argument('--remote-debugging-port=9222')
I have tried an multitude of different solutions to the DevToolsTools active port file doesn't exist issue and this seemed to to be the only one that worked. I've also uninstalled and reinstalled chrome.
#selenium modules
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service as ChromiumService
#webdriver manager modules
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.core.utils import ChromeType
#utility modules
from random import randrange
def simple_chrome(page=""):
options = Options()
debugging_port = str(randrange(9222, 9999))
options.add_argument('--remote-debugging-port=%s'%debugging_port)
service = ChromiumService(ChromeDriverManager().install())
browser = webdriver.Chrome(service=service, options=options)
browser.get(page)
return browser
browser = simple_chrome("https://docs.python.org/3/library/shutil.html")
browser2 = simple_chrome("https://apnews.com")