Selenium Grid 4, How to match a particular pattern capability in ruby 3.x.x
See original GitHub issueWhat happened?
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
How can we reproduce the issue?
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)
### Relevant log output
```shell
browser getting initialized whatever the args we pass
Operating System
ubuntu 18.04
Selenium version
selenium 4.1.2
What are the browser(s) and version(s) where you see this issue?
chrome Version 99.0.4844.82 (Official Build) (64-bit)
What are the browser driver(s) and version(s) where you see this issue?
ChromeDriver 99.0.4844.51
Are you using Selenium Grid?
Selenium Grid 4.1.2 (revision 9a5a329c5a)
Issue Analytics
- State:
- Created a year ago
- Comments:11 (5 by maintainers)
Top GitHub Comments
The correct command to create the nodes :
Correct code to add ruby options:
Thanks a lot for your quick response & the best solution 😃
@diemol @titusfortner
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.