String extensionJs, BrowserConfigurationOptions browserConfiguration, boolean ensureClean, RemoteControlConfiguration configuration)
throws RemoteCommandException {
final FrameGroupCommandQueueSet queueSet;
final BrowserSessionInfo sessionInfo;
final BrowserLauncher launcher;
final String sessionId;
sessionId = UUID.randomUUID().toString().replace("-", "");
queueSet = makeQueueSet(sessionId, configuration.getPortDriversShouldContact(), configuration);
queueSet.setExtensionJs(extensionJs);
try {
launcher = browserLauncherFactory.getBrowserLauncher(browserString, sessionId, configuration, browserConfiguration);
} catch (InvalidBrowserExecutableException e) {
throw new RemoteCommandException(e.getMessage(), "");
}
sessionInfo = new BrowserSessionInfo(sessionId, browserString, startURL, launcher, queueSet);
SeleniumDriverResourceHandler.setLastSessionId(sessionId);
LOGGER.info("Allocated session " + sessionId + " for " + startURL + ", launching...");
try {
launcher.launchRemoteSession(startURL);
queueSet.waitForLoad(configuration.getTimeoutInSeconds() * 1000l);
// TODO DGF log4j only
// NDC.push("sessionId="+sessionId);
FrameGroupCommandQueueSet queue = getQueueSet(sessionId);