浏览器不在 Selenoid [Capybara, Rspec] 中启动

The browsers doesn't start in Selenoid [Capybara, Rspec]

我正在尝试配置 capybara + rspec +selenoid,以在无头模式下进行 运行 测试。 这是我的配置

Capybara.default_max_wait_time = 5
Capybara.javascript_driver = :selenium_chrome_headless
Capybara.current_driver = :selenium_chrome_headless
caps = Selenium::WebDriver::Remote::Capabilities.new
caps['browserName'] = 'chrome'
caps['browserVersion'] = '88.0'
caps['"enableVNC"'] = 'True'

Selenium::WebDriver.for(
  :remote,
  url: 'http://localhost:4444/wd/hub',
  desired_capabilities: caps
)

我运行我的测试-rspec spec/spec_test.rb:

require_relative '../spec_helper.rb'

link1 = 'https://github.com'
link2 = 'https://yandex.ru'
link3 = 'https://www.google.com'

feature 'Main test' do
  scenario 'Test for check selenoid' do
    [link1, link2, link3].each { |l| visit l; sleep 5 }
  end
end

但是当我启动 http://localhost:8080б 时,我看不到浏览器中发生了什么。 如果我启动 http://localhost:8080/status

{"state":{"total":5,"used":1,"queued":0,"pending":0,"browsers":{"chrome":{"87.0":{},"88.0":{"unknown":{"count":1,"sessions":[{"id":"109e35b770004249fa66059b8135edac","container":"c11ff9c042dcd4e30725fb11c7613cfc7ec26c014035d7b74a0b974bf4b45006","caps":{"browserName":"chrome","version":"88.0","screenResolution":"1920x1080x24","enableVNC":false,"name":"","timeZone":""}}]}}},"firefox":{"84.0":{},"85.0":{}},"opera":{"72.0":{},"73.0":{}}},"videos":null},"origin":"http://selenoid:4444","browsers":{"chrome":1,"firefox":0,"opera":0},"sessions":{"109e35b770004249fa66059b8135edac":{"id":"109e35b770004249fa66059b8135edac","container":"c11ff9c042dcd4e30725fb11c7613cfc7ec26c014035d7b74a0b974bf4b45006","caps":{"browserName":"chrome","version":"88.0","screenResolution":"1920x1080x24","enableVNC":false,"name":"","timeZone":""},"quota":"unknown"}},"version":"1.10.2[2020-11-18_07:31:01AM]","errors":[]}

我在首选项中检测到“enableVNC”:false,这可能非常重要? 也许我没有考虑到某些设置?

但是,如果我 运行 只测试 ruby spec/spec_test.rb,没有设置,我在 selenoid

中看不到启动的浏览器
caps = Selenium::WebDriver::Remote::Capabilities.new
caps['browserName'] = 'chrome'
caps['version'] = '88'
caps['"enableVNC"'] = 'True'
Selenium::WebDriver.logger.level = :info
driver = Selenium::WebDriver.for(
  :remote,
  url: 'http://127.0.0.1:4444/wd/hub',
  desired_capabilities: caps
)

driver.get 'https://www.google.com'
sleep 5
driver.quit

应该是:

caps['enableVNC'] = true

如果使用Toolium,例如,就更简单了:

remote-properties.cfg <- remote 是你的配置名称,properties 是 Toolium 框架的关键字。

[Capabilities]
enableVNC: true