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 ………..

You Might Also Like
Comments
comments powered by Disqus