SeleniumHQ/selenium · error · OSError
Can't find server .jar located at {path}
Error message
Can't find server .jar located at {path} What it means
Raised as OSError by the Server.path setter when a path is provided but os.path.exists returns False. The setter validates existence immediately on assignment so the user discovers a wrong path at configuration time rather than at server start time.
Source
Thrown at py/selenium/webdriver/remote/server.py:100
return self._startup_timeout
@startup_timeout.setter
def startup_timeout(self, timeout):
self._startup_timeout = int(timeout)
@property
def status_url(self):
host = self.host if self.host is not None else "localhost"
return f"http://{host}:{self.port}/status"
@property
def path(self):
return self._path
@path.setter
def path(self, path):
if path and not os.path.exists(path):
raise OSError(f"Can't find server .jar located at {path}")
self._path = path
@property
def port(self):
return self._port
@port.setter
def port(self, port):
try:
port = int(port)
except ValueError:
raise TypeError(f"{__class__.__name__}.__init__() got an invalid port: '{port}'")
if not (0 <= port <= 65535):
raise ValueError("port must be 0-65535")
self._port = port
@property
def version(self):View on GitHub (pinned to aa36b38e69)
Solutions
- Verify the path exists before passing it: os.path.exists(path)
- Use an absolute path with os.path.abspath or pathlib.Path.resolve()
- Download the Selenium Grid jar first if it is not yet present
Example fix
// before
server = Server(path='selenium-server.jar') # relative, wrong CWD
// after
import os
jar = os.path.abspath('/opt/selenium/selenium-server.jar')
server = Server(path=jar) Defensive patterns
Strategy: validation
Validate before calling
import os
jar_path = '/opt/selenium-server.jar'
if not os.path.exists(jar_path):
raise FileNotFoundError(f'Server jar not found: {jar_path}')
server = Server(path=jar_path) Type guard
import os
def jar_exists(path: str) -> bool:
return bool(path) and os.path.exists(path) Try / catch
try:
server = Server(path=jar_path)
except OSError:
download_selenium_jar(jar_path) # fetch then retry
server = Server(path=jar_path) Prevention
- Verify jar existence with os.path.exists before passing path
- Use absolute paths to avoid CWD issues
- Download the Selenium Grid jar as a prerequisite build step in CI
When it happens
Trigger: Calling Server(path='/nonexistent/selenium-server.jar') or server.path = '/wrong/path.jar' triggers the OSError. The path must point to an existing file before assignment.
Common situations: Typo in the jar path. Wrong working directory for relative paths. CI environments where the jar hasn't been downloaded yet. Paths from config that reference a location not present on the current machine.
Related errors
- Add-on path does not exist: {addon_path}
- Not allowed to specify a version when using an existing serv
- {__class__.__name__}.__init__() got an invalid port: '{port}
- port must be 0-65535
- {__class__.__name__}.__init__() got an invalid version: '{ve
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/6ffdac6d6ab7d9e5.
Report an issue: GitHub.