How to run Watir-Webdriver tests in Selenium Grid2
Asked Answered
B

0

6

I might be missing something obvious but here is what i have setup:

  1. CentOs 6.4 Headless VM ( running Selenium hub )
  2. CentOs 6.4 Headless VM ( running node ) (same VM as # 1)
  3. Windows Xp Pro VM ( Running node )
  4. CentOs 6.4 Headless VM ( Running Watir Tests )

on 1,2, and 4, i run the command rvm use ruby-2.1.1 , and apply the puppet modules to install the following gems: ['watir-webdriver', 'headless', 'bacon', 'selenium-webdriver','rspec','cucumber','test-unit','page-object', 'ci_reporter' ]

then, on #1, i run:

java -Xms1024M -Xmx2048M -jar selenium-server-standalone-2.40.0.jar -role hub

on #2, ( Which is the same machine as #1, i run:

java -jar selenium-server-standalone-2.40.0.jar -role node -host <#1 VM DNS> -port 5555 -hub http://<#1VM DNS>:4444/grid/register

or the command:

java -jar selenium-server-standalone-2.40.0.jar -role node -hub http://<#1 VM DNS>:4444/grid/register -maxSession 20 -port 5555

in BOTH Cases , i get no indication on the hub, that the node has indeed connected, or at the node that it has registered to the hub, the last lines i get on the node are:

06:20:03.931 INFO - Starting auto register thread. Will try to register every 5000 ms.
06:20:03.932 INFO - Registering the node to hub :http://<#1 VM DNS>:4444/grid/register

IMO, "Registering" means in progress, and not completed. anyway, so i open the hub console @

http://<#1 VM DNS>:4444/

and i get:

You are using grid 2.40.0 Find help on the official selenium wiki : more help here default monitoring page : console

Click on Console link, and i see the following Proxies connected:

id : http://<#3 IP Address, of Windows Xp Pro>:5555, OS : XP

I had the old command running on Windows Xp ( So when the hub came back up, it seems it connected )

C:\Documents and Settings\user1>java -jar selenium-server-standalone-2.40. 0.jar -role node -hubHost <#1 VM DNS> -hubPort 4444

Now, i need to run a simple test in ruby/Watir for firefox against the windows node.

as i cannot run a browser test against the headless VM #1, or #4, unless i have the xvfb frame buffer installed and running, right ?

now when i run

require "watir-webdriver"

caps = Selenium::WebDriver::Remote::Capabilities.firefox
caps.version = 12
caps.platform = :WINDOWS
caps[:name] = "Watir WebDriver"

browser = Watir::Browser.new(
  :remote,
  :url => "http://<#1 VM DNS>:4444/wd/hub",
  :desired_capabilities => caps)

browser.goto "http://www.google.com"
p browser.title == "Google"
browser.close

i get error:

[remote server] org.openqa.grid.web.servlet.handler.RequestHandler(RequestHandler.java):114:in `process': Error forwarding the new session cannot find : Capabilities [{platform=WINDOWS, javascriptEnabled=true, cssSelectorsEnabled=true, browserName=firefox, nativeEvents=false, name=Watir WebDriver, rotatable=false, takesScreenshot=true, version=12}] (org.openqa.grid.common.exception.GridException) (Selenium::WebDriver::Error::UnknownError)

Beaner answered 20/3, 2014 at 11:4 Comment(3)
ok resolved it by #15411578Beaner
and removing the line caps.version = 12Beaner
hope this would help someone who is struggling with the same situationBeaner

© 2022 - 2024 — McMap. All rights reserved.