Undocumented way to select a node on a Selenium Grid2

3,205 views
Skip to first unread message

Juan Antonio Ruzafa

unread,
Apr 2, 2012, 11:20:14 AM4/2/12
to Selenium Users
There is an undocumented way to select a node in a grid to test your
application. You can use the "applicationName" capability to do this.
Currently, there is no way for Selenium to diference between 32 and
64 bits version of a given OS. So if you want to test with a specific
version you could setup the nodes as:

NODE1:
java -jar selenium-server-standalone-2.20.0.jar -role node -hub
http://HUB_IP:4444/grid/register -browser
browserName=firefox,version=11,maxInstances=1,platform=WINDOWS,applicationName=windows7_32bits_firefox_11

NODE2:
java -jar selenium-server-standalone-2.20.0.jar -role node -hub
http://HUB_IP:4444/grid/register -browser
browserName=firefox,version=11,maxInstances=1,platform=WINDOWS,applicationName=windows7_64bits_firefox_11

In your tests you have to add
"applicationName=windows7_32bits_firefox_11" to your desired
capabilities array.


You can see the source code at:
http://code.google.com/p/selenium/source/browse/trunk/java/server/src/org/openqa/grid/internal/utils/DefaultCapabilityMatcher.java

public DefaultCapabilityMatcher() {
toConsider.add(CapabilityType.PLATFORM);
toConsider.add(CapabilityType.BROWSER_NAME);
toConsider.add(CapabilityType.VERSION);
toConsider.add("applicationName");

}


BTW, it would be nice that someone adds this information to Grid2 wiki
page.



David

unread,
Apr 2, 2012, 5:11:04 PM4/2/12
to Selenium Users
Thanks for the tip. I'll try it out sometime. This could be useful for
other things like specifically naming nodes (for particularly config,
etc.) and as such then integrate with tools like AutoIt or Sikuli in a
Grid2 config.

http://autumnator.wordpress.com/2011/12/22/autoit-sikuli-and-other-tools-with-selenium-grid/

On Apr 2, 8:20 am, Juan Antonio Ruzafa <jaruz...@gmail.com> wrote:
> There is an undocumented way to select a node in a grid to test your
> application. You can use the "applicationName" capability to do this.
> Currently, there is no way for  Selenium to diference between 32 and
> 64 bits version of a given OS. So if you want to test with a specific
> version you could setup the nodes as:
>
> NODE1:
> java -jar selenium-server-standalone-2.20.0.jar -role node -hubhttp://HUB_IP:4444/grid/register-browser
> browserName=firefox,version=11,maxInstances=1,platform=WINDOWS,applicationN ame=windows7_32bits_firefox_11
>
> NODE2:
> java -jar selenium-server-standalone-2.20.0.jar -role node -hubhttp://HUB_IP:4444/grid/register-browser
> browserName=firefox,version=11,maxInstances=1,platform=WINDOWS,applicationN ame=windows7_64bits_firefox_11
>
> In your tests you have to add
> "applicationName=windows7_32bits_firefox_11" to your desired
> capabilities array.
>
> You can see the source code at:http://code.google.com/p/selenium/source/browse/trunk/java/server/src...

Mike Riley

unread,
Apr 3, 2012, 1:17:22 PM4/3/12
to Selenium Users
As I understand it platform is simply a string that gets matched. All
you would need to do is set it to WINDOWS64 for your node and do the
same for when you want to run a Win64 test. No need to use an
undocumented, and hence unreliable, method that may disappear on you
or be co-opted for other uses later.

Mike

On Apr 2, 8:20 am, Juan Antonio Ruzafa <jaruz...@gmail.com> wrote:
> There is an undocumented way to select a node in a grid to test your
> application. You can use the "applicationName" capability to do this.
> Currently, there is no way for  Selenium to diference between 32 and
> 64 bits version of a given OS. So if you want to test with a specific
> version you could setup the nodes as:
>
> NODE1:
> java -jar selenium-server-standalone-2.20.0.jar -role node -hubhttp://HUB_IP:4444/grid/register-browser
> browserName=firefox,version=11,maxInstances=1,platform=WINDOWS,applicationName=windows7_32bits_firefox_11
>
> NODE2:
> java -jar selenium-server-standalone-2.20.0.jar -role node -hubhttp://HUB_IP:4444/grid/register-browser
> browserName=firefox,version=11,maxInstances=1,platform=WINDOWS,applicationName=windows7_64bits_firefox_11
>
> In your tests you have to add
> "applicationName=windows7_32bits_firefox_11" to your desired
> capabilities array.
>
> You can see the source code at:http://code.google.com/p/selenium/source/browse/trunk/java/server/src...

Krishnan Mahadevan

unread,
Apr 3, 2012, 9:32:47 PM4/3/12
to seleniu...@googlegroups.com
Mike
I dont think you can change the value of Platform to anything apart from what is defined in the Platform enum class. 
So it wont work if you change it to anything else. 
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.



--
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/

Krishnan Mahadevan

unread,
Apr 3, 2012, 9:42:13 PM4/3/12
to seleniu...@googlegroups.com
Mike
I dont think you can change the value of Platform to anything apart from what is defined in the Platform enum class. 
So it wont work if you change it to anything else. 

On Tuesday, April 3, 2012, Mike Riley wrote:
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

Juan Antonio Ruzafa

unread,
Apr 4, 2012, 6:16:40 AM4/4/12
to Selenium Users
Hi Mike, your method doesn't work due platform string it's actually an
enumerated class so you can not simply assign an arbitrary value to it
(I've tested it!).

You've got the point that an undocumented method is unreliable for
future versions, this is why I hope this "undocumented" method turns
to a "documented" method soon!

Juan Antonio Ruzafa


On Apr 3, 7:17 pm, Mike Riley <lvskip...@cox.net> wrote:
> As I understand it platform is simply a string that gets matched.  All
> you would need to do is set it to WINDOWS64 for your node and do the
> same for when you want to run a Win64 test.  No need to use an
> undocumented, and hence unreliable, method that may disappear on you
> or be co-opted for other uses later.
>
> Mike
>

Juan Antonio Ruzafa

unread,
Apr 4, 2012, 6:24:18 AM4/4/12
to Selenium Users
I've submitted an issue with this info.
http://code.google.com/p/selenium/issues/detail?id=3660

Mike Riley

unread,
Apr 4, 2012, 1:16:15 PM4/4/12
to seleniu...@googlegroups.com
I see what you mean, now that I looked at the code.  I thought those were simply predefined strings, but that any arbitrary one could be used.  That would certainly be more flexible.

So far 64-bit versus 32-bit has not been an issue for us.

Mike
Reply all
Reply to author
Forward
0 new messages