Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d74be79

Browse files
Customize a node docs enhancement
* Added details on how node types * Made some formatting changes to the docs.
1 parent cf4a040 commit d74be79

File tree

4 files changed

+202
-33
lines changed

4 files changed

+202
-33
lines changed

‎website_and_docs/content/documentation/grid/advanced_features/customize_node.en.md‎

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ aliases: [
99
---
1010

1111

12-
### How to customize a Node
12+
## How to customize a Node
1313

1414
There are times when we would like a Node to be customized to our needs.
1515

@@ -29,20 +29,40 @@ Following steps can be followed for this:
2929

3030
Let's see an example of all this:
3131

32+
### Custom Node as an uber jar
33+
3234
1. Create a sample project using your favourite build tool (**Maven**|**Gradle**).
3335
2. Add the below two dependencies to your sample project.
34-
* [org.seleniumhq.selenium/selenium-java](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java)
35-
* [org.seleniumhq.selenium/selenium-grid](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-grid)
36+
* [org.seleniumhq.selenium/selenium-java](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java)
37+
* [org.seleniumhq.selenium/selenium-grid](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-grid)
38+
3. Add your customized Node to the project.
39+
4. Build an [uber jar](https://imagej.net/develop/uber-jars) to be able to start the Node using `java -jar` command.
40+
5. Now start the Node using the command:
41+
42+
```bash
43+
java -jar custom_node-server.jar node \
44+
--node-implementation org.seleniumhq.samples.DecoratedLoggingNode
45+
```
46+
**Note:** We need `selenium-java` as a dependency so that we can support all the common browser flavors via our uber jar execution.
47+
48+
### Custom Node as a regular jar
49+
50+
1. Create a sample project using your favourite build tool (**Maven**|**Gradle**).
51+
2. Add the below dependencies to your sample project.
52+
* [org.seleniumhq.selenium/selenium-remote-driver](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver)
53+
* [org.seleniumhq.selenium/selenium-grid](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-grid)
3654
3. Add your customized Node to the project.
37-
4. Build an [uber jar](https://imagej.net/develop/uber-jars) if you would like to just use `java -jar` to start the Node.
55+
4. Build a jar of your project using your build tool.
3856
5. Now start the Node using the command:
3957

4058
```bash
41-
java -jar custom_node-1.0-SNAPSHOT.jar node \
42-
--node-implementation org.seleniumhq.samples.CommentatingNode
59+
java -jar selenium-server-4.6.0.jar \
60+
--ext custom_node-1.0-SNAPSHOT.jar node \
61+
--node-implementation org.seleniumhq.samples.DecoratedLoggingNode
4362
```
63+
**Note:** Here we are **NOT** using `selenium-java` as a dependency because its already part of the original selenium uber jar and we are just adding our custom node to the classpath via the `--ext` argument.
4464

45-
Here's a sample that just prints some messages on to the console whenever there's an activity of interest (session created, session deleted, a webdriver command executed etc.,) on the Node.
65+
Below is a sample that just prints some messages on to the console whenever there's an activity of interest (session created, session deleted, a webdriver command executed etc.,) on the Node.
4666

4767

4868
<details>
@@ -88,7 +108,10 @@ public class DecoratedLoggingNode extends Node {
88108
BaseServerOptions serverOptions = new BaseServerOptions(config);
89109
URI uri = serverOptions.getExternalUri();
90110
SecretOptions secretOptions = new SecretOptions(config);
111+
112+
// Refer to the foot notes for additional context on this line.
91113
Node node = LocalNodeFactory.create(config);
114+
92115
DecoratedLoggingNode wrapper = new DecoratedLoggingNode(loggingOptions.getTracer(),
93116
uri, secretOptions.getRegistrationSecret());
94117
wrapper.node = node;
@@ -208,4 +231,23 @@ public class DecoratedLoggingNode extends Node {
208231
}
209232
}
210233
```
211-
</details>
234+
</details>
235+
236+
**_Foot Notes:_**
237+
238+
In the above example, the line `Node node = LocalNodeFactory.create(config);` explicitly creates a `LocalNode`.
239+
240+
There are basically 2 types of *user facing implementations* of `org.openqa.selenium.grid.node.Node` available.
241+
242+
These classes are good starting points to learn how to build a custom Node and also to learn the internals of a Node.
243+
244+
* `org.openqa.selenium.grid.node.local.LocalNode` - Used to represent a long running Node and is the default implementation that gets wired in when you start a `node`.
245+
* It can be created by calling `LocalNodeFactory.create(config);`, where:
246+
* `LocalNodeFactory` belongs to `org.openqa.selenium.grid.node.local`
247+
* `Config` belongs to `org.openqa.selenium.grid.config`
248+
* `org.openqa.selenium.grid.node.k8s.OneShotNode` - This is a special reference implementation wherein the Node gracefully shuts itself down after servicing one test session. This class is currently not available as part of any pre-built maven artifact.
249+
* You can refer to the source code [here](https://github.com/SeleniumHQ/selenium/blob/trunk/java/src/org/openqa/selenium/grid/node/k8s/OneShotNode.java) to understand its internals.
250+
* To build it locally refer [here](https://github.com/SeleniumHQ/selenium/blob/trunk/deploys/k8s/README.md).
251+
* It can be created by calling `OneShotNode.create(config)`, where:
252+
* `OneShotNode` belongs to `org.openqa.selenium.grid.node.k8s`
253+
* `Config` belongs to `org.openqa.selenium.grid.config`

‎website_and_docs/content/documentation/grid/advanced_features/customize_node.ja.md‎

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ aliases: [
1717
</p>
1818
{{% /pageinfo %}}
1919

20-
### How to customize a Node
20+
## How to customize a Node
2121

2222
There are times when we would like a Node to be customized to our needs.
2323

@@ -37,20 +37,40 @@ Following steps can be followed for this:
3737

3838
Let's see an example of all this:
3939

40+
### Custom Node as an uber jar
41+
4042
1. Create a sample project using your favourite build tool (**Maven**|**Gradle**).
4143
2. Add the below two dependencies to your sample project.
42-
* [org.seleniumhq.selenium/selenium-java](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java)
43-
* [org.seleniumhq.selenium/selenium-grid](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-grid)
44+
* [org.seleniumhq.selenium/selenium-java](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java)
45+
* [org.seleniumhq.selenium/selenium-grid](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-grid)
46+
3. Add your customized Node to the project.
47+
4. Build an [uber jar](https://imagej.net/develop/uber-jars) to be able to start the Node using `java -jar` command.
48+
5. Now start the Node using the command:
49+
50+
```bash
51+
java -jar custom_node-server.jar node \
52+
--node-implementation org.seleniumhq.samples.DecoratedLoggingNode
53+
```
54+
**Note:** We need `selenium-java` as a dependency so that we can support all the common browser flavors via our uber jar execution.
55+
56+
### Custom Node as a regular jar
57+
58+
1. Create a sample project using your favourite build tool (**Maven**|**Gradle**).
59+
2. Add the below dependencies to your sample project.
60+
* [org.seleniumhq.selenium/selenium-remote-driver](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver)
61+
* [org.seleniumhq.selenium/selenium-grid](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-grid)
4462
3. Add your customized Node to the project.
45-
4. Build an [uber jar](https://imagej.net/develop/uber-jars) if you would like to just use `java -jar` to start the Node.
63+
4. Build a jar of your project using your build tool.
4664
5. Now start the Node using the command:
4765

4866
```bash
49-
java -jar custom_node-1.0-SNAPSHOT.jar node \
50-
--node-implementation org.seleniumhq.samples.CommentatingNode
67+
java -jar selenium-server-4.6.0.jar \
68+
--ext custom_node-1.0-SNAPSHOT.jar node \
69+
--node-implementation org.seleniumhq.samples.DecoratedLoggingNode
5170
```
71+
**Note:** Here we are **NOT** using `selenium-java` as a dependency because its already part of the original selenium uber jar and we are just adding our custom node to the classpath via the `--ext` argument.
5272

53-
Here's a sample that just prints some messages on to the console whenever there's an activity of interest (session created, session deleted, a webdriver command executed etc.,) on the Node.
73+
Below is a sample that just prints some messages on to the console whenever there's an activity of interest (session created, session deleted, a webdriver command executed etc.,) on the Node.
5474

5575

5676
<details>
@@ -96,7 +116,10 @@ public class DecoratedLoggingNode extends Node {
96116
BaseServerOptions serverOptions = new BaseServerOptions(config);
97117
URI uri = serverOptions.getExternalUri();
98118
SecretOptions secretOptions = new SecretOptions(config);
119+
120+
// Refer to the foot notes for additional context on this line.
99121
Node node = LocalNodeFactory.create(config);
122+
100123
DecoratedLoggingNode wrapper = new DecoratedLoggingNode(loggingOptions.getTracer(),
101124
uri, secretOptions.getRegistrationSecret());
102125
wrapper.node = node;
@@ -216,4 +239,23 @@ public class DecoratedLoggingNode extends Node {
216239
}
217240
}
218241
```
219-
</details>
242+
</details>
243+
244+
**_Foot Notes:_**
245+
246+
In the above example, the line `Node node = LocalNodeFactory.create(config);` explicitly creates a `LocalNode`.
247+
248+
There are basically 2 types of *user facing implementations* of `org.openqa.selenium.grid.node.Node` available.
249+
250+
These classes are good starting points to learn how to build a custom Node and also to learn the internals of a Node.
251+
252+
* `org.openqa.selenium.grid.node.local.LocalNode` - Used to represent a long running Node and is the default implementation that gets wired in when you start a `node`.
253+
* It can be created by calling `LocalNodeFactory.create(config);`, where:
254+
* `LocalNodeFactory` belongs to `org.openqa.selenium.grid.node.local`
255+
* `Config` belongs to `org.openqa.selenium.grid.config`
256+
* `org.openqa.selenium.grid.node.k8s.OneShotNode` - This is a special reference implementation wherein the Node gracefully shuts itself down after servicing one test session. This class is currently not available as part of any pre-built maven artifact.
257+
* You can refer to the source code [here](https://github.com/SeleniumHQ/selenium/blob/trunk/java/src/org/openqa/selenium/grid/node/k8s/OneShotNode.java) to understand its internals.
258+
* To build it locally refer [here](https://github.com/SeleniumHQ/selenium/blob/trunk/deploys/k8s/README.md).
259+
* It can be created by calling `OneShotNode.create(config)`, where:
260+
* `OneShotNode` belongs to `org.openqa.selenium.grid.node.k8s`
261+
* `Config` belongs to `org.openqa.selenium.grid.config`

‎website_and_docs/content/documentation/grid/advanced_features/customize_node.pt-br.md‎

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ aliases: [
1717
</p>
1818
{{% /pageinfo %}}
1919

20-
### How to customize a Node
20+
## How to customize a Node
2121

2222
There are times when we would like a Node to be customized to our needs.
2323

@@ -37,23 +37,44 @@ Following steps can be followed for this:
3737

3838
Let's see an example of all this:
3939

40+
### Custom Node as an uber jar
41+
4042
1. Create a sample project using your favourite build tool (**Maven**|**Gradle**).
4143
2. Add the below two dependencies to your sample project.
42-
* [org.seleniumhq.selenium/selenium-java](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java)
43-
* [org.seleniumhq.selenium/selenium-grid](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-grid)
44+
* [org.seleniumhq.selenium/selenium-java](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java)
45+
* [org.seleniumhq.selenium/selenium-grid](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-grid)
4446
3. Add your customized Node to the project.
45-
4. Build an [uber jar](https://imagej.net/develop/uber-jars) if you would like to just use `java -jar` to start the Node.
47+
4. Build an [uber jar](https://imagej.net/develop/uber-jars) to be able to start the Node using `java -jar` command.
4648
5. Now start the Node using the command:
4749

4850
```bash
49-
java -jar custom_node-1.0-SNAPSHOT.jar node \
50-
--node-implementation org.seleniumhq.samples.CommentatingNode
51+
java -jar custom_node-server.jar node \
52+
--node-implementation org.seleniumhq.samples.DecoratedLoggingNode
5153
```
54+
**Note:** We need `selenium-java` as a dependency so that we can support all the common browser flavors via our uber jar execution.
55+
56+
### Custom Node as a regular jar
57+
58+
1. Create a sample project using your favourite build tool (**Maven**|**Gradle**).
59+
2. Add the below dependencies to your sample project.
60+
* [org.seleniumhq.selenium/selenium-remote-driver](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-remote-driver)
61+
* [org.seleniumhq.selenium/selenium-grid](https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-grid)
62+
3. Add your customized Node to the project.
63+
4. Build a jar of your project using your build tool.
64+
5. Now start the Node using the command:
65+
66+
```bash
67+
java -jar selenium-server-4.6.0.jar \
68+
--ext custom_node-1.0-SNAPSHOT.jar node \
69+
--node-implementation org.seleniumhq.samples.DecoratedLoggingNode
70+
```
71+
**Note:** Here we are **NOT** using `selenium-java` as a dependency because its already part of the original selenium uber jar and we are just adding our custom node to the classpath via the `--ext` argument.
72+
73+
Below is a sample that just prints some messages on to the console whenever there's an activity of interest (session created, session deleted, a webdriver command executed etc.,) on the Node.
5274

53-
Here's a sample that just prints some messages on to the console whenever there's an activity of interest (session created, session deleted, a webdriver command executed etc.,) on the Node.
5475

55-
<summary>Sample customized node</summary>
5676
<details>
77+
<summary>Sample customized node</summary>
5778

5879
```java
5980
package org.seleniumhq.samples;
@@ -95,7 +116,10 @@ public class DecoratedLoggingNode extends Node {
95116
BaseServerOptions serverOptions = new BaseServerOptions(config);
96117
URI uri = serverOptions.getExternalUri();
97118
SecretOptions secretOptions = new SecretOptions(config);
119+
120+
// Refer to the foot notes for additional context on this line.
98121
Node node = LocalNodeFactory.create(config);
122+
99123
DecoratedLoggingNode wrapper = new DecoratedLoggingNode(loggingOptions.getTracer(),
100124
uri, secretOptions.getRegistrationSecret());
101125
wrapper.node = node;
@@ -215,4 +239,23 @@ public class DecoratedLoggingNode extends Node {
215239
}
216240
}
217241
```
218-
</details>
242+
</details>
243+
244+
**_Foot Notes:_**
245+
246+
In the above example, the line `Node node = LocalNodeFactory.create(config);` explicitly creates a `LocalNode`.
247+
248+
There are basically 2 types of *user facing implementations* of `org.openqa.selenium.grid.node.Node` available.
249+
250+
These classes are good starting points to learn how to build a custom Node and also to learn the internals of a Node.
251+
252+
* `org.openqa.selenium.grid.node.local.LocalNode` - Used to represent a long running Node and is the default implementation that gets wired in when you start a `node`.
253+
* It can be created by calling `LocalNodeFactory.create(config);`, where:
254+
* `LocalNodeFactory` belongs to `org.openqa.selenium.grid.node.local`
255+
* `Config` belongs to `org.openqa.selenium.grid.config`
256+
* `org.openqa.selenium.grid.node.k8s.OneShotNode` - This is a special reference implementation wherein the Node gracefully shuts itself down after servicing one test session. This class is currently not available as part of any pre-built maven artifact.
257+
* You can refer to the source code [here](https://github.com/SeleniumHQ/selenium/blob/trunk/java/src/org/openqa/selenium/grid/node/k8s/OneShotNode.java) to understand its internals.
258+
* To build it locally refer [here](https://github.com/SeleniumHQ/selenium/blob/trunk/deploys/k8s/README.md).
259+
* It can be created by calling `OneShotNode.create(config)`, where:
260+
* `OneShotNode` belongs to `org.openqa.selenium.grid.node.k8s`
261+
* `Config` belongs to `org.openqa.selenium.grid.config`

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /