MCPcopy Create free account
hub / github.com/SeleniumHQ/selenium / is_connectable

Function is_connectable

py/selenium/webdriver/common/utils.py:112–132  ·  view source on GitHub ↗

Tries to connect to the server at port to see if it is running. Args: port: port number host: hostname or IP

(port: int, host: str | None = "localhost")

Source from the content-addressed store, hash-verified

110
111
112def is_connectable(port: int, host: str | None = "localhost") -> bool:
113 """Tries to connect to the server at port to see if it is running.
114
115 Args:
116 port: port number
117 host: hostname or IP
118 """
119 socket_ = None
120 try:
121 socket_ = socket.create_connection((host, port), 1)
122 result = True
123 except _is_connectable_exceptions:
124 result = False
125 finally:
126 if socket_:
127 try:
128 socket_.shutdown(socket.SHUT_RDWR)
129 except Exception:
130 pass
131 socket_.close()
132 return result
133
134
135def is_url_connectable(

Callers 1

find_connectable_ipFunction · 0.85

Calls 2

closeMethod · 0.65
shutdownMethod · 0.45

Tested by

no test coverage detected