@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);
  }
Example #2
0
  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);
  }
Example #3
0
  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;
  }
Example #4
0
 /**
  * <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");
 }
Example #5
0
 private String executeCommand(String methodName, final String[] values) {
   return commandProcessor.doCommand(methodName, values);
 }
Example #6
0
  public void stopBrowser() {
    commandProcessor.stop();
    commandProcessor = null;

    LOG.info("Command processor stopped");
  }
Example #7
0
 private void waitForPageLoadIfNeeded(ExtendedSeleniumCommand command) {
   if (command.isAndWaitCommand()) {
     commandProcessor.doCommand("waitForPageToLoad", new String[] {"" + timeout});
   }
 }