Eivind
Eivind

Reputation: 301

How to pick a custom port for Selenium running in Python

Apparently, Selenium uses port 4444 by default. Would it be possible to customize this in Python so that multiple instances of the same application could be spawned simultaneously?

This is how I currently initialize the browser in Python:

from selenium import webdriver
driver = webdriver.Chrome(PATH_TO_CHROMEDRIVER_EXE)
...
driver.quit()

Upvotes: 3

Views: 9460

Answers (1)

pfctdayelise
pfctdayelise

Reputation: 5285

You can add port information while creating the chrome webdriver, for eg.

from selenium import webdriver
driver = webdriver.Chrome(PATH_TO_CHROMEDRIVER_EXE, port=8080)

this will set the port on which the driver will be running

Upvotes: 3

Related Questions