硒网格4,如何匹配红宝石3.xx中的特定图案能力
我无法匹配 selenium grid 4 节点的 ruby 代码中的自定义功能。
根据本文档:https://www.selenium。 dev/documentation/grid/configuration/cli_options/#matching-node-a
我尝试在 ruby 中做同样的事情,如下所示:
- 使用此命令启动硒网格:
java -jar ./selenium-server-4.1.2.jar hub --session-request-timeout 500 --port 4444 --tracing false
- 开始运行节点下面的命令:
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"}'
然后从我的 Ruby 代码中,我尝试连接到使用 custom_key1 和 custom_value1 的节点“a”,如下所示:
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)
所以在这里我能够获取驱动程序,但它是从上述节点随机获取的。如果我传递custom_key1和custom_value1,那么我应该仅从该节点“a”获取浏览器。但是浏览器会话也在节点“b”中创建。即使我从代码中传递了 custom_key1 之后,我仍然从节点“b”获取浏览器。
有人可以帮我将这个特定的节点与某种模式相匹配吗
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正确创建节点的正确命令:
正确的代码以添加Ruby选项:
The correct command to create the nodes :
Correct code to add ruby options: