Class Node
java.lang.Object
org.openqa.selenium.grid.node.Node
- All Implemented Interfaces:
HttpHandler, Routable, HasReadyState
- Direct Known Subclasses:
LocalNode, RemoteNode
A place where individual webdriver sessions are running. Those sessions may be in-memory, or only
reachable via localhost and a network. Or they could be something else entirely.
This class responds to the following URLs:
| Verb | URL Template | Meaning |
|---|---|---|
| POST | /se/grid/node/session | Attempts to start a new session for the given node. The posted data should be a
json-serialized Capabilities instance. Returns a serialized Session.
Subclasses of Node are expected to register the session with the
SessionMap. |
| GET | /se/grid/node/session/{sessionId} | Finds the Session identified by sessionId and returns the JSON-serialized
form. |
| DELETE | /se/grid/node/session/{sessionId} | Stops the Session identified by sessionId. It is expected that this will
also cause the session to removed from the
SessionMap. |
| GET | /se/grid/node/owner/{sessionId} | Allows the node to be queried about whether or not it owns the Session identified
by sessionId. This returns a boolean. |
| DELETE | /se/grid/node/connection/{sessionId} | Notifies the node about closure of a websocket connection for the Session
identified by sessionId. |
| POST | /se/grid/node/connection/{sessionId} | Allows the node to be ask about whether or not new websocket connections are allowed for the Session
identified by sessionId. This returns a boolean. |
| * | /session/{sessionId}/* | The request is forwarded to the Session identified by sessionId. When the
Quit command is called, the Session should remove itself from the
SessionMap. |
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AtomicBooleanprotected final AtomicBooleanprotected final Tracer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract @Nullable HttpResponsedownloadFile(HttpRequest req, SessionId id) abstract voiddrain()execute(HttpRequest req) abstract HttpResponsefireSessionEvent(HttpRequest req, SessionId id) Fires a custom session event to the remote server event bus.abstract HealthCheckgetId()abstract SessiongetSession(SessionId id) abstract NodeStatusgetUri()booleanbooleanabstract booleanabstract booleanisSupporting(Capabilities capabilities) booleanmatches(HttpRequest req) abstract Either<WebDriverException, CreateSessionResponse> newSession(CreateSessionRequest sessionRequest) voidregister()abstract voidabstract voidabstract booleanabstract @Nullable HttpResponseuploadFile(HttpRequest req, SessionId id) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HasReadyState
isReady
-
Field Details
-
tracer
-
draining
-
registered
-
-
Constructor Details
-
Node
-
-
Method Details
-
getId
-
getUri
-
getNodeVersion
-
getOsInfo
-
newSession
public abstract Either<WebDriverException, CreateSessionResponse> newSession(CreateSessionRequest sessionRequest) -
executeWebDriverCommand
-
getSession
- Throws:
NoSuchSessionException
-
getUploadsFilesystem
- Throws:
IOException
-
getDownloadsFilesystem
- Throws:
IOException
-
uploadFile
-
downloadFile
-
fireSessionEvent
Fires a custom session event to the remote server event bus. This allows test code to trigger server-side utilities that subscribe to the event bus.Default implementation throws
UnsupportedOperationException. Subclasses that support session events should override this method.- Parameters:
req- the HTTP request containing the event dataid- the session ID- Returns:
- the HTTP response
-
stop
- Throws:
NoSuchSessionException
-
isSessionOwner
-
tryAcquireConnection
-
releaseConnection
-
isSupporting
-
getStatus
-
getHealthCheck
-
getSessionTimeout
-
isDraining
public boolean isDraining() -
isRegistered
public boolean isRegistered() -
register
public void register() -
drain
public abstract void drain() -
matches
-
execute
- Specified by:
executein interfaceHttpHandler
-