Skip to content

Commit 9b05019

Browse files
Adds possibility to set node stereotype (SeleniumHQ#1666)
* Allow SE_NODE_STEREOTYPE env var to set the stereotype * Adds SE_NODE_STEREOTYPE to Readme * Adds example with default value for SE_NODE_STEREOTYPE [deploy]
1 parent fd403f3 commit 9b05019

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

NodeBase/generate_config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ elif [[ "${SE_NODE_BROWSER_NAME}" == "MicrosoftEdge" ]]; then
5959
SE_NODE_BROWSER_VERSION=$(short_version $(microsoft-edge --version | awk '{print $3}'))
6060
fi
6161

62+
if [[ -z "$SE_NODE_STEREOTYPE" ]]; then
6263
SE_NODE_STEREOTYPE="{\"browserName\": \"${SE_NODE_BROWSER_NAME}\", \"browserVersion\": \"${SE_NODE_BROWSER_VERSION}\", \"platformName\": \"Linux\"}"
64+
else
65+
SE_NODE_STEREOTYPE="$SE_NODE_STEREOTYPE"
66+
fi
67+
6368
echo "[[node.driver-configuration]]" >> "$FILENAME"
6469
echo "display-name = \"${SE_NODE_BROWSER_NAME}\"" >> "$FILENAME"
6570
echo "stereotype = '${SE_NODE_STEREOTYPE}'" >> "$FILENAME"

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -779,11 +779,16 @@ In both cases, it is necessary to tell the Node where the Event Bus is, so it ca
779779
the purpose of the `SE_EVENT_BUS_HOST`, `SE_EVENT_BUS_PUBLISH_PORT` and `SE_EVENT_BUS_SUBSCRIBE_PORT` environment
780780
variables.
781781

782-
Here is an example with the default values of these environment variables:
782+
In some cases, for example if you want to tag a node, it might be necessary to supply a custom stereotype to the node config. The environement variable `SE_NODE_STEREOTYPE`
783+
sets the stereotype entry in the node's `config.toml`. An example config.toml file can be found here: [Setting custom capabilities for matching specific Nodes](https://www.selenium.dev/documentation/grid/configuration/toml_options/#setting-custom-capabilities-for-matching-specific-nodes).
783784

785+
Here is an example with the default values of these environment variables:
784786
```bash
785-
$ docker run -d -e SE_EVENT_BUS_HOST=<event_bus_ip|event_bus_name> -e SE_EVENT_BUS_PUBLISH_PORT=4442 \
786-
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 --shm-size="2g" selenium/node-chrome:4.4.0-20220812
787+
$ docker run -d \
788+
-e SE_EVENT_BUS_HOST=<event_bus_ip|event_bus_name> \
789+
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
790+
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 -e SE_NODE_STEREOTYPE="{\"browserName\":\"${SE_NODE_BROWSER_NAME}\",\"browserVersion\":\"${SE_NODE_BROWSER_VERSION}\",\"platformName\": \"Linux\"}" \
791+
--shm-size="2g" selenium/node-chrome:4.4.0-20220812
787792
```
788793

789794
### Setting Screen Resolution

0 commit comments

Comments
 (0)