@BeforeTest private void initializeMocks() { parentProcessor = mock(CommandProcessor.class); when(parentProcessor.doCommand(eq(VALID_COMMAND), Matchers.<String[]>any())).thenReturn(null); when(parentProcessor.doCommand(eq(EXCEPTION_THROWING_COMMAND), Matchers.<String[]>any())) .thenThrow(new RuntimeException()); exceptionThrowingScreenshotter = new ExceptionThrowingScreenshotter(); processor = new ScreenshotHttpCommandProcessor(parentProcessor, exceptionThrowingScreenshotter); }
private String executeArrayCommand(String methodName, final String[] values) { String[] output = commandProcessor.getStringArray(methodName, values); if (output != null && LOG.isDebugEnabled()) { LOG.debug("Command processor returned '" + Arrays.asList(output) + "'"); } return stringArrayToString(output); }
private String executeCommand(String methodName, final String[] values) { String output = commandProcessor.doCommand(methodName, values); if (output != null && LOG.isDebugEnabled()) { LOG.debug("Command processor returned '" + output + "'"); } return output; }
/** * <code> * | start browser | <i>firefox</i> | on url | <i>http://localhost</i> | using remote server on host | <i>localhost</i> | on port | <i>4444</i> | * </code> * * @param browser * @param browserUrl * @param serverHost * @param serverPort * @deprecated This call requires a Selenium 1 server. It is advised to use WebDriver. */ public void startBrowserOnUrlUsingRemoteServerOnHostOnPort( final String browser, final String browserUrl, final String serverHost, final int serverPort) { setCommandProcessor( new HttpCommandProcessorAdapter( new HttpCommandProcessor( serverHost, serverPort, browser, removeAnchorTag(browserUrl)))); commandProcessor.start(); setTimeoutOnSelenium(); LOG.debug("Started HTML command processor"); }
private String executeCommand(String methodName, final String[] values) { return commandProcessor.doCommand(methodName, values); }
public void stopBrowser() { commandProcessor.stop(); commandProcessor = null; LOG.info("Command processor stopped"); }
private void waitForPageLoadIfNeeded(ExtendedSeleniumCommand command) { if (command.isAndWaitCommand()) { commandProcessor.doCommand("waitForPageToLoad", new String[] {"" + timeout}); } }