Setting capabilities for remote selenium grid. Named nodes.

771 views
Skip to first unread message

Ivan Danci

unread,
Jun 18, 2013, 7:34:28 AM6/18/13
to seleniu...@googlegroups.com
I'm trying to spawn a lot of driver simultaneously, but I want my tasks to have priority. I don't want to write prioritizer for selenium, I have my own scheduler which tells to selenium when to launch a specific task.

For prioritizing I think I might use named nodes. For example "important firefox on linux", "not important chrome on windows" etc. I tried to specify names for nodes, but when I add {:name => "important firefox on linux"} selenium starts default firefox browser on an idle node.

How can I call a specific node?
What am I doing wrong?


My class that manages selenium:

  def remote_driver
   
@browser = Watir::Browser.new(:remote,
     
:url                  => "http:://.....:4444/wd/hub",
      :http_client          => client,
     
:desired_capabilities => capabilities
   
)
 
end


  def capabilities
   
Selenium::WebDriver::Remote::Capabilities.send(
     
@driver_name,
     
:javascript_enabled    => true,
     
:css_selectors_enabled => true,
     
:takes_screenshot      => true
   
)
 
end

  def client
    client
= Selenium::WebDriver::Remote::Http::Default.new
    client
.timeout = 360
    client
 
end

Configs:
hubConfig.json.erb
{
 
"host": null,
 
"port": <%= node[:selenium][:server][:port] %>,
 
"newSessionWaitTimeout": -1,
 
"servlets" : [],
 
"prioritizer": null,
 
"capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher",
 
"throwOnCapabilityNotPresent": true,
 
"nodePolling": <%= node[:selenium][:server][:node_polling] %>,
 
"cleanUpCycle": <%= node[:selenium][:server][:cleanup_cycle] %>,
 
"timeout": <%= node[:selenium][:server][:timeout] %>,
 
"browserTimeout": 0,
 
"maxSession": <%= node[:selenium][:server][:max_session] %>
}

{
  "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": <%= node[:selenium][:node][:max_session] %>,
    "port": <%= node[:selenium][:node][:port] %>,
    "host": "<%= node[:fqdn] %>",
    "register": true,
    "registerCycle": <%= node[:selenium][:node][:register_cycle] %>,
    "hubPort": <%= node[:selenium][:server][:port] %>
  }
}


Krishnan Mahadevan

unread,
Jun 18, 2013, 9:32:59 AM6/18/13
to Selenium Users
Ivan,
In order for you to be able to target a specific node, have you tried adding either version (or) applicationName to your node configuration json file and see if that works ?

something like this :

{
      "browserName": "firefox",
      "maxInstances": 5,
"applicationName" : "MyApp",
"version": "FF important",
      "seleniumProtocol": "WebDriver"
    },



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/0b327e18-302e-45c4-8295-d5f2de572514%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages