I'm unable to match the custom capabilities in ruby code for selenium grid 4 nodes.
As per this documentation: https://www.selenium.dev/documentation/grid/configuration/cli_options/#matching-node-a
I've tried to do the same thing in ruby like below:
- Started the selenium grid with this command:
java -jar ./selenium-server-4.1.2.jar hub --session-request-timeout 500 --port 4444 --tracing false
- Started Running nodes with the below commands:
node a) java -jar selenium-server-4.1.2.jar node --max-sessions 74 --log-level "fine" --port 5555 --driver-implementation "chrome" --override-max-sessions true --max-threads 55 --driver-configuration display-name="$(hostname)" stereotype='{"browserName":"chrome","custom_key1":"custom_value1"}'
node b) java -jar selenium-server-4.1.2.jar node --max-sessions 74 --log-level "fine" --port 5556 --driver-implementation "chrome" --override-max-sessions true --max-threads 55 --driver-configuration display-name="$(hostname)" stereotype='{"browserName":"chrome","custom_key2":"custom_value2"}'
Then From My Ruby Code, I've tried to connect to the node 'a' which uses custom_key1 and custom_value1 like below:
options = Selenium::WebDriver::Chrome::Options.new(args: ['start-maximized'])
caps = {"custom_key1":"custom_value1"}
options.add_option("my_options",caps)
And finally trying to initialize the browser:
driver = Selenium::WebDriver.for(:remote, :url => "http://192.168.29.141:4444", :capabilities => options)
So here Im able to get the driver but its getting randomly from the above nodes. If I pass custom_key1 and custom_value1 then I should get the browser from that node 'a' only. But However browser session is getting created in node 'b' too. Im getting browser from node 'b' even after I pass custom_key1 from my code.
Could someone please help me to match this particular nodes with some pattern