硒网格4,如何匹配红宝石3.xx中的特定图案能力

发布于 2025-01-18 19:03:22 字数 1726 浏览 0 评论 0原文

我无法匹配 selenium grid 4 节点的 ruby​​ 代码中的自定义功能。

根据本文档:https://www.selenium。 dev/documentation/grid/configuration/cli_options/#matching-node-a

我尝试在 ruby​​ 中做同样的事情,如下所示:

  1. 使用此命令启动硒网格:
java -jar ./selenium-server-4.1.2.jar  hub --session-request-timeout 500 --port 4444 --tracing false

  1. 开始运行节点下面的命令:
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:

  1. Started the selenium grid with this command:
java -jar ./selenium-server-4.1.2.jar  hub --session-request-timeout 500 --port 4444 --tracing false

  1. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

波浪屿的海角声 2025-01-25 19:03:22

正确创建节点的正确命令:

A)
java -jar selenium-server-4.1.2.jar node --detect-drivers false --log-level "fine" --port 5555   --override-max-sessions true --max-threads 55 --driver-configuration display-name="$(hostname)" max-sessions=74 stereotype='{"browserName":"chrome","cluster:pcgeo":"hetzner"}'
B)
java -jar selenium-server-4.1.2.jar node --detect-drivers false --log-level "fine" --port 5556   --override-max-sessions true --max-threads 55 --driver-configuration display-name="$(hostname)" max-sessions=74 stereotype='{"browserName":"chrome","cluster:pcgeo":"aws"}'

正确的代码以添加Ruby选项:

opt = Selenium::WebDriver::Chrome::Options.new(args: ['start-maximized'])
opt.add_option("cluster:pcgeo","aws_india")
driver = Selenium::WebDriver.for(:remote, :url => "http://192.168.29.141:4444" , :capabilities => opt)

The correct command to create the nodes :

A)
java -jar selenium-server-4.1.2.jar node --detect-drivers false --log-level "fine" --port 5555   --override-max-sessions true --max-threads 55 --driver-configuration display-name="$(hostname)" max-sessions=74 stereotype='{"browserName":"chrome","cluster:pcgeo":"hetzner"}'
B)
java -jar selenium-server-4.1.2.jar node --detect-drivers false --log-level "fine" --port 5556   --override-max-sessions true --max-threads 55 --driver-configuration display-name="$(hostname)" max-sessions=74 stereotype='{"browserName":"chrome","cluster:pcgeo":"aws"}'

Correct code to add ruby options:

opt = Selenium::WebDriver::Chrome::Options.new(args: ['start-maximized'])
opt.add_option("cluster:pcgeo","aws_india")
driver = Selenium::WebDriver.for(:remote, :url => "http://192.168.29.141:4444" , :capabilities => opt)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文