CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/maven-org-seleniumhq-selenium--selenium-server

Selenium Grid server that enables distributed test execution across multiple browsers and operating systems.

Pending
Overview
Eval results
Files

rest-api.mddocs/

HTTP REST API

The Selenium Grid server exposes comprehensive REST API endpoints for WebDriver protocol implementation, session management, node registration, and Grid administration.

Capabilities

Router Endpoints

Router component handles WebDriver protocol endpoints and routes requests to appropriate nodes based on session ID.

// WebDriver session creation
POST /session
Content-Type: application/json
{
  "capabilities": {
    "alwaysMatch": { "browserName": "chrome" },
    "firstMatch": [{}]
  }
}

// WebDriver commands routing
GET    /session/{sessionId}/url          // Get current URL
POST   /session/{sessionId}/url          // Navigate to URL
GET    /session/{sessionId}/title        // Get page title
POST   /session/{sessionId}/element      // Find element
DELETE /session/{sessionId}              // Delete session

All standard W3C WebDriver endpoints are supported and automatically routed to the correct node based on session ownership.

Session Map Endpoints

Session map manages the mapping between session IDs and their corresponding node URIs.

// Register session with session map
POST /se/grid/session/{sessionId}
Content-Type: application/json
{
  "sessionId": "string",
  "uri": "http://node-host:port"
}

// Retrieve session URI
GET /se/grid/session/{sessionId}
Response: {
  "sessionId": "string", 
  "uri": "http://node-host:port"
}

// Remove session from map
DELETE /se/grid/session/{sessionId}
Response: HTTP 200 OK

Distributor Endpoints

Distributor manages node registration and routes new session requests to available nodes.

// Create new session (WebDriver standard)
POST /session
Content-Type: application/json
{
  "capabilities": {
    "alwaysMatch": { "browserName": "firefox" },
    "firstMatch": [{}]
  }
}
Response: {
  "value": {
    "sessionId": "string",
    "capabilities": { "browserName": "firefox", ... }
  }
}

// Add node to distributor
POST /se/grid/distributor/node
Content-Type: application/json
{
  "id": "uuid",
  "uri": "http://node-host:port",
  "capacity": {
    "available": [
      { "capabilities": { "browserName": "chrome", "maxInstances": 5 }, "count": 5 }
    ]
  }
}

// Remove node from distributor
DELETE /se/grid/distributor/node/{nodeId}
Response: HTTP 200 OK

// Get distributor status
GET /status
Response: {
  "value": {
    "ready": true,
    "message": "Distributor is ready",
    "nodes": [...]
  }
}

Node Endpoints

Node endpoints handle session creation, WebDriver command execution, and node status reporting.

// Create session on this node
POST /se/grid/node/session
Content-Type: application/json
{
  "capabilities": { "browserName": "chrome" }
}
Response: {
  "sessionId": "string",
  "capabilities": { "browserName": "chrome", ... }
}

// Get session details
GET /se/grid/node/session/{sessionId}
Response: {
  "sessionId": "string",
  "capabilities": { ... },
  "uri": "http://node-host:port"
}

// Stop session on this node
DELETE /se/grid/node/session/{sessionId}
Response: HTTP 200 OK

// Check if node owns session
GET /se/grid/node/owner/{sessionId}
Response: {
  "value": true  // or false
}

// Get node status
GET /status
Response: {
  "value": {
    "ready": true,
    "message": "Node is ready",
    "capacity": {
      "available": [...],
      "used": [...]
    }
  }
}

// Forward WebDriver commands (any WebDriver endpoint)
* /session/{sessionId}/*
// All standard WebDriver commands are supported

Data Formats

Session Data Format

Standard session representation used across Grid components.

// Session JSON structure
{
  "sessionId": "string",           // Unique session identifier
  "capabilities": {                // Browser capabilities
    "browserName": "chrome",
    "browserVersion": "91.0",
    "platformName": "linux"
  },
  "uri": "http://node-host:port"   // Node URI hosting the session
}

Node Status Format

Node status information including capacity and current usage.

// NodeStatus JSON structure
{
  "id": "uuid",                    // Unique node identifier
  "uri": "http://node-host:port",  // Node URI
  "capacity": {
    "available": [
      {
        "capabilities": {          // Available browser capabilities
          "browserName": "chrome",
          "maxInstances": 5
        },
        "count": 3                 // Available instances
      }
    ],
    "used": [
      {
        "capabilities": {          // Used browser capabilities
          "browserName": "chrome"
        },
        "count": 2                 // Used instances
      }
    ]
  }
}

WebDriver Request/Response Format

All WebDriver endpoints follow W3C WebDriver specification format.

// Standard WebDriver response format
{
  "value": {                       // Response data
    // Command-specific response data
  },
  "status": 0,                     // Optional status code (legacy)
  "sessionId": "string"            // Session ID (when applicable)
}

// WebDriver error response format
{
  "value": {
    "error": "no such element",    // Error code
    "message": "Element not found", // Human-readable message
    "stacktrace": "..."            // Stack trace (optional)
  }
}

Error Handling

The API returns standard WebDriver error responses following W3C WebDriver specification:

// Common error types
"invalid session id"             // Session not found or expired
"no such element"               // Element not found
"element not interactable"      // Element cannot be interacted with
"session not created"           // Failed to create session
"timeout"                       // Operation timed out
"unknown error"                 // General server error

Content Types

All endpoints expect and return JSON data with appropriate Content-Type headers:

// Request headers
Content-Type: application/json; charset=utf-8

// Response headers  
Content-Type: application/json; charset=utf-8

HTTP Status Codes

Standard HTTP status codes are used throughout the API:

200 OK                          // Successful operation
201 Created                     // Resource created successfully
400 Bad Request                 // Invalid request format
404 Not Found                   // Resource not found
500 Internal Server Error       // Server error

Install with Tessl CLI

npx tessl i tessl/maven-org-seleniumhq-selenium--selenium-server

docs

cli.md

configuration.md

extensions.md

index.md

rest-api.md

tile.json