title: Naming selenium grid nodes. Spawning a specific node
body: <p>I'm trying to implement a kind of default queues in selenium hub.
  There is a possibility to specify node's name (actually its environment, smth like "firefox on ubuntu" or "chrome on windows"). Selenium grid itself has a default queue, it works according to 'First In, First Out' principle. But I want to prioritize some of my tasks given to selenium server. I have no possibility to introduce custom queue (seems like there is no API for that), that's why I decided to separate queue's logic from selenium server. I'll only call a specific node with specific name (environment) for example "firefox important node" or smth like that.</p>
  
  <p>So, I want to know how to directly tell selenium which node to use for my task?
  And generally, am I thinking in a right way?</p>
  
  <p>Here are my configs:
  hubConfig.json.erb</p>
  
  <pre><code>{
    "host": null,
    "port": &lt;%= node[:selenium][:server][:port] %&gt;,
    "newSessionWaitTimeout": -1,
    "servlets" : [],
    "prioritizer": null,
    "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
    "throwOnCapabilityNotPresent": true,
    "nodePolling": &lt;%= node[:selenium][:server][:node_polling] %&gt;,
    "cleanUpCycle": &lt;%= node[:selenium][:server][:cleanup_cycle] %&gt;,
    "timeout": &lt;%= node[:selenium][:server][:timeout] %&gt;,
    "browserTimeout": 0,
    "maxSession": &lt;%= node[:selenium][:server][:max_session] %&gt;
  }
  </code></pre>
  
  <p>nodeConfig.json.erb</p>
  
  <pre><code>{
    "capabilities": [
      {
        "browserName": "firefox",
        "maxInstances": 5,
        "seleniumProtocol": "WebDriver"
      }, {
        "browserName": "chrome",
        "maxInstances": 5,
        "seleniumProtocol": "WebDriver"
      }, {
        "browserName": "phantomjs",
        "maxInstances": 5,
        "seleniumProtocol": "WebDriver"
      }
    ],
    "configuration": {
      "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
      "maxSession": &lt;%= node[:selenium][:node][:max_session] %&gt;,
      "port": &lt;%= node[:selenium][:node][:port] %&gt;,
      "host": "&lt;%= node[:fqdn] %&gt;",
      "register": true,
      "registerCycle": &lt;%= node[:selenium][:node][:register_cycle] %&gt;,
      "hubPort": &lt;%= node[:selenium][:server][:port] %&gt;
    }
  }
  </code></pre>
  
  <p>And my Driver class:</p>
  
  <pre><code>  ...
    def remote_driver
      @browser = Watir::Browser.new(:remote,
        :url                  =&gt; "http://myhub.com:4444/wd/hub",
        :http_client          =&gt; client,
        :desired_capabilities =&gt; capabilities
      )
    end
  
    def capabilities
      Selenium::WebDriver::Remote::Capabilities.send(
        "firefox",
        :javascript_enabled    =&gt; true,
        :css_selectors_enabled =&gt; true,
        :takes_screenshot      =&gt; true
      )
    end
  
    def client
      client = Selenium::WebDriver::Remote::Http::Default.new
      client.timeout = 360
      client
    end
    ...
  </code></pre>
  
  <p>I still don't know how to use specified node for my task.
  If I try to start a driver adding <code>:name =&gt; "firefox important node"</code> and extend nodeConfig.json.erb's configuration with</p>
  
  <pre><code>environments:
     - name:    "firefox important node"
       browser: "*firefox"
     - name:    "Firefox36 on Linux"
       browser: "*firefox"
  </code></pre>
  
  <p>selenium just starts random firefox browser on a random node. How can I control it?</p>