Selenium RC environments with whitespace characters

We use selenium grid to orchestrate our acceptance testing over multiple browsers on multiple platforms. One of the nice things with registering environments with the selenium grid hub, is that you can use descriptive names like: “IE on Windows XP” and “Firefox on OS X” for example.

I was having difficulties with environment names with whitespace characters, so after a lot of experimentation, here are the tweaks I made to get it working across all Linux and Windows.

The Rakefile for the selenium-grid needs to have the rc_args method redefined as follows (notice the changes on lines 6 and 7):

def rc_args(options)
args = []
args << "-host" << (options[:host] || ENV['HOST'] || "localhost") args << "-port" << options[:port] args << "-hubUrl" << (options[:hub_url] || ENV['HUB_URL'] || 'http://localhost:4444') args << "-env" << "\"#{(options[:environment] || ENV['ENVIRONMENT'] || "*chrome")}\"" args << "-env" << "\"#{(options[:environment] || ENV['ENVIRONMENT'] || "*chrome")}\"" args << (options[:selenium_args] || ENV['SELENIUM_ARGS'] || "") args end [/sourcecode] Now you can run the RCs from the command line as follows: On windows:

rake rc:start PORT=5555 HUB_URL=http://172.16.7.122:4444 HOST=172.16.7.119 ENVIRONMENT="IE on Windows Vista"

On linux:

rake rc:start PORT=5555 HUB_URL=http://172.16.7.122:4444 HOST=172.16.7.119 ENVIRONMENT=Safari\ on\ OS\ X

 

Advertisements

One Response to “Selenium RC environments with whitespace characters”

  1. Selenium RC environments with whitespace characters « Fringley's Blog Says:

    […] reading Selenium RC environments with whitespace characters on my other blog… Tags javascript, selenium, testing Categories […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: