在Grid2上运行Selenium测试

在Grid2上运行Selenium测试,selenium,Selenium,我有一个正在运行的Selenium网格 我有一个基本的测试,我正在尝试使用Ruby和TestUnit运行它 require "test/unit" require "rubygems" gem "selenium-client" require "selenium/client" class Test3 < Test::Unit::TestCase def setup @verification_errors = [] puts "Running tests..."

我有一个正在运行的Selenium网格

我有一个基本的测试,我正在尝试使用Ruby和TestUnit运行它

require "test/unit"
require "rubygems"
gem "selenium-client"
require "selenium/client"

class Test3 < Test::Unit::TestCase

  def setup
    @verification_errors = []
    puts "Running tests..."
    @selenium = Selenium::Client::Driver.new \
      :host => "http://ec2-54-244-205-27.us-west-2.compute.amazonaws.com:7055/wd/hub",
      :browser => "*chrome",
      :url => "https://news.google.com/",
      :timeout_in_second => 60

    @selenium.start_new_browser_session
  end

  def teardown
    @selenium.close_current_browser_session
    assert_equal [], @verification_errors
  end

  def test_test3
    @selenium.open "/nwshp?hl=en&tab=wn&authuser=0"
    @selenium.click "css=#gb_5 > span.gbts"
    @selenium.wait_for_page_to_load "30000"
    @selenium.click "css=div.main-appbar"
    @selenium.click "css=span.titletext"
  end
end

我不明白如何让我的测试连接到Selenium网格。我做错了什么?我的WebDriver的URL应该是WebDriverRemoteProxy下面的“侦听”吗?

我感觉您已经创建了充当
WebDriver
角色的中心节点

为了向后兼容,“wd”和“rc”角色是“节点”角色的有效子集。但这些角色将远程连接的类型限制为其相应的API,而“节点”同时允许RC和WebDriver远程连接

考虑到您正在运行的RC,请尝试将节点的角色定义为
RC
,或者更好地定义为
node

java -jar selenium-server-standalone-2.31.0.jar -role node -port 7056  -hub http://ec2-54-244-205-27.us-west-2.compute.amazonaws.com:7055
您的selenium远程实例如下

    @selenium = Selenium::Client::Driver.new \
      :host => "http://ec2-54-244-205-27.us-west-2.compute.amazonaws.com:7055/wd/hub",
      :browser => "*googlechrome",
      :url => "https://news.google.com/",
      :timeout_in_second => 60

当您创建节点时,您是如何定义其角色的?您还可以从您打算从中运行测试的机器ping EC2机器吗?您是正确的。我将测试作为远程控制导出,而不是WebDriver。我再次将该测试导出为WebDriver,但现在我得到了Errno::ETIMEDOUT:操作超时-连接(2)您可以通过更新问题来分享您的操作方式吗。我已编辑了上面的问题。这样做了。谢谢现在,我只需要安装它看起来像的浏览器依赖项。
    @selenium = Selenium::Client::Driver.new \
      :host => "http://ec2-54-244-205-27.us-west-2.compute.amazonaws.com:7055/wd/hub",
      :browser => "*googlechrome",
      :url => "https://news.google.com/",
      :timeout_in_second => 60