Run multiple instances of ChromeDriver

Using selenium and python, I have several tests that need to be run in parallel. To avoid using the same browser, I added the option to use a specific profile and user data (see below). The problem is that I can not run them at the same time, one test must wait for the completion of another. Otherwise, I get the following error from chromedriver:

Starting ChromeDriver 2.29.461591 (62ebf098771772160f391d75e589dc567915b233) on port 9515
Only local connections are allowed.
[0.000][SEVERE]: bind() returned an error: Only one usage of each socket address (protocol/network address/port) is normally permitted. (0x2740)

Selenium setup:

  chrome_options = webdriver.ChromeOptions()
  chrome_options.add_argument('--user-data-dir=C:/ChromeProfile')
  chrome_options.add_argument("--profile-directory=Profile1")#Profile2,Profile3, etc
  chrome_options.add_argument('--start-maximized')
  chrome_options.add_argument('--incognito')
  self.driver = webdriver.Chrome(executable_path='C:/Chrome/chromedriver.exe',chrome_options=chrome_options)
+5
source share
2 answers

try it

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--user-data-dir=C:/ChromeProfile/Profile1')#Profile2,Profile3, etc.

Do not use

chrome_options.add_argument("--profile-directory=Profile1")

--profile-directory designed for multiple profiles in one browser

+1
source

What is equivalent on Linux / Mac?

0

Source: https://habr.com/ru/post/1684086/


All Articles