Running WebdriverJS test on selenium grid

I have a selenium grid running on AmazonEC2

It consists of a hub running on port 7055 and a node running on port 7056.

I have the following test:

var webdriver = require('selenium-webdriver'), driver = new webdriver.Builder(). usingServer('http://ec2-50-18-75-182.us-west-1.compute.amazonaws.com:7055/wd/hub'). withCapabilities({'browserName': 'firefox'}). build(); var postTitle = "Post "+(+new Date); driver.get('http://si-demo.herokuapp.com/posts/new'); driver.findElement(webdriver.By.id('post_name')).sendKeys("Selenium"); driver.findElement(webdriver.By.id('post_title')).sendKeys(postTitle); driver.findElement(webdriver.By.id('post_content')).sendKeys("This is auto generated by a test"); driver.findElement(webdriver.By.name('commit')).click(); driver.quit(); 

This fails when I try to connect to the hub port. The test runs when I connect directly to the node port.

Error connecting to grid hub:

 timers.js:103 if (!process.listeners('uncaughtException').length) throw e; ^ Error: ETIMEDOUT connect ETIMEDOUT at ClientRequest.sendRequest (/Users/jason/Development/cirrus/spanish-inquisition-runner/node_modules/selenium-webdriver/http/index.js:127:16) at ClientRequest.EventEmitter.emit (events.js:96:17) at Socket.socketErrorListener (http.js:1436:9) at Socket.EventEmitter.emit (events.js:96:17) at Socket._destroy.self.errorEmitted (net.js:329:14) at process.startup.processNextTick.process._tickCallback (node.js:244:9) ==== async task ==== WebDriver.createSession() at Function.webdriver.WebDriver.acquireSession_ (/Users/jason/Development/cirrus/spanish-inquisition-runner/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:130:49) at Function.webdriver.WebDriver.createSession (/Users/jason/Development/cirrus/spanish-inquisition-runner/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:109:30) at Builder.build (/Users/jason/Development/cirrus/spanish-inquisition-runner/node_modules/selenium-webdriver/builder.js:70:22) at Object.<anonymous> (/Users/jason/Development/cirrus/spanish-inquisition-runner/open_canvas.js:5:8) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.runMain (module.js:492:10) 

My question is: Does Selenium WebdriverJS support connecting to a hub? If so, what am I doing wrong?

Notes:

  • I connected to the hub and successfully completed the same steps as the rspec test.
  • I was also able to connect to the hub locally on the EC2 instance and run the test only when you try to connect remotely to the grid.
  • When you look at the Selenium2 grid console at: 7055 / grid / console, it seems to be using a session on node.

Commands that I used in EC2 to start the grid:

 Xvfb :0 -screen 0 1024x768x24 2>&1 >/dev/null & export DISPLAY=:0 java -jar selenium-server-standalone-2.32.0.jar -port 7055 -role hub xvfb-run java -jar selenium-server-standalone-2.32.0.jar -role node -hub http://localhost:7055/grid/register 
+4
source share
1 answer

Have you tried using a remote webdriver? I do not have a JS driver, but C # has a special driver for remote network connections.

https://code.google.com/p/selenium/wiki/WebDriverJs#Using_the_Stand-alone_Selenium_Server

When looking at JS docs, you probably need to do something when you create your driver:

 var webdriver = require('selenium-webdriver'), SeleniumServer = require('selenium-webdriver/remote').SeleniumServer; 
0
source

All Articles