Setting user extensions when the Selenium Server has been started dynamically

>I hope this helps someone someday, I needed to set user extension for a selenium test suite, dynamically in the code as i was starting the Selenium server via same.

public void startSeleniumServer(String port) {

rcc = new RemoteControlConfiguration();
rcc.setPort(Integer.parseInt(port));

try {
seleniumServer = new SeleniumServer(false, rcc);
seleniumServer.start();

} catch (Exception e) {
throw new IllegalStateException(“Can’t start selenium server”, e);
}
}

public void stopSeleniumServer() {
if (seleniumServer != null) {
seleniumServer.stop();
}
}

i was setting the user extension file using the remoteControlConfiguration object

so i had typed:

rcc.setUserExtensions(new File({path_location_to_user_extension.js}));

This didnt work and an extensive search in the api wasnt very useful.
A colleague however found out that doing a

seleniumServer.boot(); would make the user-extension file to work.

Great isn’t it ………..

Advertisements
This entry was posted in Software Testing and tagged , , , , , , . Bookmark the permalink.

One Response to Setting user extensions when the Selenium Server has been started dynamically

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