0
# Command Line Interface
1
2
The Selenium Grid server provides traditional Grid 3 role-based commands and limited modern command support for different deployment scenarios in version 3.141.59.
3
4
## Capabilities
5
6
### Main Entry Points
7
8
Multiple entry points available for Grid server operations:
9
10
```bash { .api }
11
# Traditional Grid 3 syntax (recommended for v3.141.59)
12
java -jar selenium-server-standalone-3.141.59.jar -role <hub|node|standalone> [options]
13
14
# Modern command syntax (limited support in v3.141.59)
15
java -jar selenium-server-standalone-3.141.59.jar <command> [options]
16
17
# Direct class invocation (advanced)
18
java -cp selenium-server-standalone-3.141.59.jar org.openqa.grid.selenium.GridLauncherV3 [options]
19
```
20
21
If no role or command is specified, runs as standalone server on port 4444.
22
23
### Available Commands
24
25
#### Traditional Grid 3 Roles (Recommended)
26
27
##### Standalone Role
28
29
Runs complete Selenium Grid setup in a single process with hub and node functionality.
30
31
```bash { .api }
32
java -jar selenium-server-standalone-3.141.59.jar -role standalone [options]
33
# Or simply (standalone is default):
34
java -jar selenium-server-standalone-3.141.59.jar [options]
35
36
# Default port: 4444
37
# Includes: Hub + Node functionality
38
```
39
40
**Usage Example:**
41
```bash
42
# Basic standalone server
43
java -jar selenium-server-standalone-3.141.59.jar -role standalone
44
45
# Custom port and host
46
java -jar selenium-server-standalone-3.141.59.jar -role standalone -port 4440 -host 192.168.1.100
47
48
# With debug logging
49
java -jar selenium-server-standalone-3.141.59.jar -role standalone -debug
50
```
51
52
##### Hub Role
53
54
Runs as Grid hub that manages node registration and session distribution.
55
56
```bash { .api }
57
java -jar selenium-server-standalone-3.141.59.jar -role hub [options]
58
59
# Default port: 4444
60
# Function: Central registry and session router
61
```
62
63
**Usage Example:**
64
```bash
65
# Basic hub
66
java -jar selenium-server-standalone-3.141.59.jar -role hub
67
68
# Hub on specific port with custom timeout
69
java -jar selenium-server-standalone-3.141.59.jar -role hub -port 4444 -timeout 300
70
```
71
72
##### Node Role
73
74
Runs as Grid node that registers with a hub and provides browser instances.
75
76
```bash { .api }
77
java -jar selenium-server-standalone-3.141.59.jar -role node [options]
78
79
# Default port: 5555
80
# Function: Provides browser instances, registers with hub
81
```
82
83
**Usage Example:**
84
```bash
85
# Node connecting to hub
86
java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://hub-host:4444
87
88
# Node with custom capabilities
89
java -jar selenium-server-standalone-3.141.59.jar -role node -hub http://hub-host:4444 \
90
-browser "browserName=chrome,maxInstances=5" \
91
-browser "browserName=firefox,maxInstances=3"
92
```
93
94
#### Modern Command Syntax (Limited Support)
95
96
##### Standalone Command
97
98
Alternative syntax for standalone server (limited options compared to -role syntax).
99
100
```bash { .api }
101
java -jar selenium-server-standalone-3.141.59.jar standalone [options]
102
103
# Default port: 4444
104
# Note: Limited option support compared to -role standalone
105
```
106
107
##### Hub Command (Modern Syntax)
108
109
Alternative syntax for hub server (limited options compared to -role hub).
110
111
```bash { .api }
112
java -jar selenium-server-standalone-3.141.59.jar hub [options]
113
114
# Default port: 4444
115
# Note: Limited option support compared to -role hub
116
```
117
118
##### Node Command (Modern Syntax)
119
120
Alternative syntax for node server (limited options compared to -role node).
121
122
```bash { .api }
123
java -jar selenium-server-standalone-3.141.59.jar node [options]
124
125
# Default port: 5555
126
# Note: Limited option support compared to -role node
127
```
128
129
##### Additional Modern Commands (Limited Support)
130
131
These commands have limited support in v3.141.59 and may not have full functionality:
132
133
```bash { .api }
134
# Router component (limited functionality)
135
java -jar selenium-server-standalone-3.141.59.jar router [options]
136
137
# Distributor component (limited functionality)
138
java -jar selenium-server-standalone-3.141.59.jar distributor [options]
139
140
# Sessions component (limited functionality)
141
java -jar selenium-server-standalone-3.141.59.jar sessions [options]
142
```
143
144
**Note:** These commands exist but have limited option support. Use traditional -role syntax for full functionality.
145
146
### Command Line Options
147
148
#### Common Options (All Roles)
149
150
Options available for all Grid 3 roles and commands.
151
152
```bash { .api }
153
# Core server options
154
-role <hub|node|standalone> # Server role (default: standalone)
155
-host <hostname> # IP or hostname (auto-detected if not set)
156
-port <integer> # Port number (default varies by role)
157
-timeout, -sessionTimeout <seconds> # Session timeout (default: 1800)
158
-browserTimeout <seconds> # Browser command timeout (default: 0)
159
-debug # Enable debug logging (LogLevel.FINE)
160
-log <filename> # Log filename (STDOUT if omitted)
161
-jettyThreads <integer> # Max Jetty threads (default: 200)
162
-version # Display version and exit
163
-help, -h # Display help
164
```
165
166
#### Hub-Specific Options (-role hub)
167
168
Options specific to hub role configuration.
169
170
```bash { .api }
171
-hubConfig <filename> # JSON config file for hub
172
-matcher <class> # Custom capability matcher class
173
-newSessionWaitTimeout <ms> # Timeout for new session requests
174
-prioritizer <class> # Custom prioritizer class
175
-throwOnCapabilityNotPresent <true/false> # Reject requests if no matching node
176
-registry <class> # Custom registry implementation
177
-cleanUpCycle <ms> # Cleanup cycle for hung threads
178
-maxSession <integer> # Max browser sessions per node
179
-servlet <class> # Extra servlets to add
180
-withoutServlet <class> # Default servlets to disable
181
-custom <key=value,key=value> # Custom key/value pairs
182
```
183
184
#### Node-Specific Options (-role node)
185
186
Options specific to node role configuration.
187
188
```bash { .api }
189
-nodeConfig <filename> # JSON config file for node
190
-hub <URL> # Hub URL (e.g., http://hub:4444/grid/register)
191
-hubHost <hostname> # Hub host address
192
-hubPort <integer> # Hub port number
193
-remoteHost <URL> # Address to report to hub
194
-id <string> # Unique node identifier
195
-capabilities <caps> # Node capabilities
196
-browser <caps> # Browser capabilities (can specify multiple)
197
-downPollingLimit <integer> # Node down polling limit
198
-nodePolling <ms> # How often hub polls node (default: 5000)
199
-nodeStatusCheckTimeout <ms> # Node status check timeout (default: 5000)
200
-proxy <class> # Proxy class (default: DefaultRemoteProxy)
201
-register <true/false> # Whether to register with hub
202
-registerCycle <ms> # Re-registration interval (default: 5000)
203
-unregisterIfStillDownAfter <ms> # Unregister timeout (default: 60000)
204
-enablePlatformVerification <true/false> # Verify platform capabilities
205
```
206
207
#### Standalone-Specific Options (-role standalone)
208
209
Options for standalone role (inherits both hub and node options).
210
211
```bash { .api }
212
-config <filename> # JSON configuration file
213
# Plus all common, hub, and node options listed above
214
```
215
216
#### Help Options
217
218
Options for getting help and version information.
219
220
```bash { .api }
221
-h, --help # Display help for the command
222
-help # Alternative help flag
223
/? # Windows-style help flag
224
--version # Display version and exit
225
```
226
227
### Command Examples
228
229
#### Single Machine Setup
230
```bash
231
# Complete Grid on one machine
232
java -jar selenium-server-standalone-3.141.59.jar standalone --port 4444
233
```
234
235
#### Distributed Setup
236
```bash
237
# Hub machine
238
java -jar selenium-server-standalone-3.141.59.jar hub --port 4444
239
240
# Node machine 1
241
java -jar selenium-server-standalone-3.141.59.jar node --port 5555 --distributor http://hub-host:4444
242
243
# Node machine 2
244
java -jar selenium-server-standalone-3.141.59.jar node --port 5556 --distributor http://hub-host:4444
245
```
246
247
#### Microservices Architecture
248
```bash
249
# Router service
250
java -jar selenium-server-standalone-3.141.59.jar router --port 4444
251
252
# Distributor service
253
java -jar selenium-server-standalone-3.141.59.jar distributor --port 5553
254
255
# Session map service
256
java -jar selenium-server-standalone-3.141.59.jar sessions --port 5556
257
258
# Node services
259
java -jar selenium-server-standalone-3.141.59.jar node --port 5555 --distributor http://distributor-host:5553 --sessions http://sessions-host:5556
260
```
261
262
### Help System
263
264
Each command supports detailed help information when run with `--help` flag:
265
266
```bash
267
# General help (lists all commands)
268
java -jar selenium-server-standalone-3.141.59.jar
269
270
# Command-specific help
271
java -jar selenium-server-standalone-3.141.59.jar standalone --help
272
java -jar selenium-server-standalone-3.141.59.jar node --help
273
```