We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 592684d commit 74a7808Copy full SHA for 74a7808
py/selenium/webdriver/remote/server.py
@@ -117,10 +117,11 @@ def start(self):
117
if self.host is not None:
118
command.extend(["--host", self.host])
119
120
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
121
host = self.host if self.host is not None else "localhost"
+
122
try:
123
- sock.connect((host, self.port))
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
124
+ sock.connect((host, self.port))
125
raise ConnectionError(f"Selenium server is already running, or something else is using port {self.port}")
126
except ConnectionRefusedError:
127
print(f"Starting Selenium server at: {self.path}")
0 commit comments