Java 类org.openqa.selenium.remote.Command 实例源码

项目:domui    文件:ChromeExtender.java   
@Nonnull
private Object send(@Nonnull String cmd, @Nonnull Map<String, Object> params) throws IOException {
    Map<String, Object> exe = ImmutableMap.of("cmd", cmd, "params", params);
    Command xc = new Command(m_wd.getSessionId(), "sendCommandWithResult", exe);
    Response response = m_wd.getCommandExecutor().execute(xc);

    Object value = response.getValue();
    if(response.getStatus() == null || response.getStatus().intValue() != 0) {
        //System.out.println("resp: " + response);
        throw new MyChromeDriverException("Command '" + cmd + "' failed: " + value);
    }
    if(null == value)
        throw new MyChromeDriverException("Null response value to command '" + cmd + "'");
    //System.out.println("resp: " + value);
    return value;
}
项目:talk2grid    文件:CustomCommandExecutor.java   
@Override
public Response execute(Command command) throws IOException {
    Response response;
    if (DriverCommand.QUIT.equals(command.getName())) {
        response = grid.execute(command);
    } else {
        response = node.execute(command);
    }
    return response;
}
项目:menggeqa    文件:AppiumCommandExecutor.java   
@Override public Response execute(Command command) throws IOException, WebDriverException {
    if (DriverCommand.NEW_SESSION.equals(command.getName()) && service != null) {
        service.start();
    }

    try {
        return super.execute(command);
    } catch (Throwable t) {
        Throwable rootCause = Throwables.getRootCause(t);
        if (rootCause instanceof ConnectException
            && rootCause.getMessage().contains("Connection refused")
            && service != null) {
            if (service.isRunning()) {
                throw new WebDriverException("The session is closed!", t);
            }

            if (!service.isRunning()) {
                throw new WebDriverException("The appium server has accidentally died!", t);
            }
        }
        Throwables.propagateIfPossible(t);
        throw new WebDriverException(t);
    } finally {
        if (DriverCommand.QUIT.equals(command.getName()) && service != null) {
            service.stop();
        }
    }
}
项目:grid-refactor-remote-server    文件:ResultConfig.java   
protected RestishHandler populate(RestishHandler handler, Command command) {
  for (Map.Entry<String, ?> entry : command.getParameters().entrySet()) {
    try {
      PropertyMunger.set(entry.getKey(), handler, entry.getValue());
    } catch (Exception e) {
      throw new WebDriverException(e);
    }
  }
  return handler;
}
项目:oscon-aus-2016    文件:DemoEventFiringListener.java   
public void beforeEvent(Command command) {
    if (command.getName().equalsIgnoreCase(DriverCommand.CLICK)) {
        System.out.println("Before click");
    }
}
项目:oscon-aus-2016    文件:DemoEventFiringListener.java   
public void afterEvent(Command command) {
    if (command.getName().equalsIgnoreCase(DriverCommand.CLICK)) {
        System.out.println("After click");
    }
}