title: Running WebdriverJS test on Selenium Grid
body: <p>I have a Selenium Grid running on AmazonEC2</p>
  
  <p>It consists of a hub running on port 7055 and a node running on port 7056.</p>
  
  <p>I have the following test:</p>
  
  <pre><code>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();
  </code></pre>
  
  <p>That fails when I try to connect to the hub port. 
  The test does run when I connect directly to the node port.</p>
  
  <p>The error I get when connecting to the grid hub is:</p>
  
  <pre><code>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.&lt;anonymous&gt; (/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)
  </code></pre>
  
  <p><strong>My question is:</strong>
  Does Selenium WebdriverJS support connecting to the hub? If so what am I doing wrong?</p>
  
  <p>Notes:</p>
  
  <ul>
  <li>I have connected to the hub and successfully run the same steps as an rspec test.</li>
  <li>I was also able to connect to the hub locally on the EC2 instance and run the test, only happens when trying to connect remotely to the grid.</li>
  <li>When looking at the Selenium2 grid console at :7055/grid/console it does appear to be using a session on the node.</li>
  </ul>
  
  <p>Commands I used on EC2 to start the grid:</p>
  
  <pre><code>Xvfb :0 -screen 0 1024x768x24 2&gt;&amp;1 &gt;/dev/null &amp;
  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
  </code></pre>