0
votes

I have a Selenium Grid running on Amazon EC2

And I have a basic test that I am trying to run using Ruby and 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

However, I keep getting the following error:

SocketError: getaddrinfo: nodename nor servname provided, or not known

I've created the Selenium Hub with the following line.

java -jar selenium-server-standalone-2.6.0.jar -role hub -port 7055

I then registered the WebDriver node by doing...

java -jar selenium-server-standalone-2.6.0.jar -role webdriver -hub http://ec2-54-244-205-27.us-west-2.compute.amazonaws.com:7055/grid/register -port 7056

My Grid Console says...

WebDriverRemoteProxy
listening on http://10.250.11.113:7056/wd/hub
test session time out after 300 sec.
Supports up to 5 concurrent tests from: 

I do not understand to make my tests connect with the Selenium Grid. What am I doing incorrectly? Is the URL for my WebDriver supposed to be the "listening on " underneath WebDriverRemoteProxy?

1
When u created the node, how did u define its role?Amey
Also can you ping the EC2 machine from the machine you intend to run the tests from?Amey
You were correct. I had exported the test as a Remote Control as opposed to WebDriver. I exported that test again as WebDriver but now I am getting Errno::ETIMEDOUT: Operation timed out - connect(2)erichrusch
Can you share how you doing it, by updating your question.Amey
I've edited my question above.erichrusch

1 Answers

1
votes

I have a feeling that you have created the node to the hub playing the role of webdriver.

For backwards compatibility "wd" and "rc" roles are a valid subset of the "node" role. But those roles limit the types of remote connections to their corresponding API, while "node" allows both RC and WebDriver remote connections.

Considering your running RC, try defining the role of the node to rc or better still 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

and your selenium remote instance like so

    @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