当前位置: 首页>>代码示例>>Java>>正文


Java Response.setSessionId方法代码示例

本文整理汇总了Java中org.openqa.selenium.remote.Response.setSessionId方法的典型用法代码示例。如果您正苦于以下问题:Java Response.setSessionId方法的具体用法?Java Response.setSessionId怎么用?Java Response.setSessionId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openqa.selenium.remote.Response的用法示例。


在下文中一共展示了Response.setSessionId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
  String ref = getRequest().getVariableValue(":reference");
  RemoteWebElement element = getWebDriver().createElement(ref);
  JsonArray array = getRequest().getPayload().getJsonArray("value");

  String value = "";
  for (JsonValue jsonValue : array) {
    value += JavaxJson.toJavaObject(jsonValue);
  }
  element.setValueAtoms(value);

  Response res = new Response();
  res.setSessionId(getSession().getSessionId());
  res.setStatus(0);
  res.setValue(new JSONObject());
  return res;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:19,代码来源:SetValueHandler.java

示例2: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
/**
 * type - {string} The type of operation to set the timeout for. Valid values are: "script" for
 * script timeouts, "implicit" for modifying the implicit wait timeout and "page load" for setting
 * a page load timeout.
 */
@Override
public Response handle() throws Exception {
  JsonObject payload = getRequest().getPayload();
  String type = payload.getString("type", "");
  final WebDriverLikeCommand command;
  if ("page load".equals(type)) {
    command = WebDriverLikeCommand.URL;
  } else if ("script".equals(type)) {
    command = WebDriverLikeCommand.EXECUTE_SCRIPT;
  } else {
    throw new UnsupportedCommandException("set timeout for " + payload);
  }

  long timeout = payload.getJsonNumber("ms").longValue();
  getSession().configure(command).set(type, timeout);

  Response res = new Response();
  res.setSessionId(getSession().getSessionId());
  res.setStatus(0);
  res.setValue(new JSONObject());
  return res;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:28,代码来源:SetTimeoutHandler.java

示例3: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
  // Handle the case where the client does not send any desired capabilities.
  sessionId = allSessions.newSession(desiredCapabilities != null
                                     ? desiredCapabilities : new DesiredCapabilities());

  Map<String, Object> capabilities =
      Maps.newHashMap(allSessions.get(sessionId).getCapabilities().asMap());

  // Only servers implementing the server-side webdriver-backed selenium need
  // to return this particular value
  capabilities.put("webdriver.remote.sessionid", sessionId.toString());

  if (desiredCapabilities != null) {
    LoggingManager.perSessionLogHandler().configureLogging(
        (LoggingPreferences)desiredCapabilities.getCapability(CapabilityType.LOGGING_PREFS));
  }
  LoggingManager.perSessionLogHandler().attachToCurrentThread(sessionId);

  Response response = new Response();
  response.setSessionId(sessionId.toString());
  response.setValue(capabilities);
  return response;
}
 
开发者ID:alexkogon,项目名称:grid-refactor-remote-server,代码行数:25,代码来源:NewSession.java

示例4: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
  String reference = getRequest().getPayload().getString("element");
  RemoteWebElement element = getWebDriver().createElement(reference);
  element.moveTo();

  Response resp = new Response();
  resp.setSessionId(getSession().getSessionId());
  resp.setStatus(0);
  resp.setValue(new JSONObject());
  return resp;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:13,代码来源:MoveToHandler.java

示例5: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
  String ref = getRequest().getVariableValue(":reference");
  RemoteWebElement element = getWebDriver().createElement(ref);
  Point location = element.getLocation();
  Response res = new Response();
  res.setSessionId(getSession().getSessionId());
  res.setStatus(0);
  res.setValue(location);
  return res;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:12,代码来源:GetLocationHandler.java

示例6: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
  Response res = new Response();
  res.setSessionId(getSession().getSessionId());
  res.setStatus(0);
  res.setValue(getWebDriver().getPageSource());
  return res;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:9,代码来源:GetPageSourceHandler.java

示例7: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
  timeout = getRequest().getPayload().getInt("ms");
  for (WebDriverLikeCommand command : impacted) {
    getSession().configure(command).set("implicit_wait", timeout);
  }

  Response res = new Response();
  res.setSessionId(getSession().getSessionId());
  res.setStatus(0);
  res.setValue(new JSONObject());
  return res;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:14,代码来源:SetImplicitWaitTimeoutHandler.java

示例8: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {

  List<Cookie> cookies = getWebDriver().getCookies();
  Response res = new Response();
  res.setSessionId(getSession().getSessionId());
  res.setStatus(0);
  res.setValue(cookies);
  return res;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:11,代码来源:GetCookiesHandler.java

示例9: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public synchronized Response handle() throws Exception {
  Response r = new Response();
  r.setSessionId(getSession().getSessionId());
  r.setValue(getWebDriver().capabilities());
  r.setStatus(0);
  return r;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:9,代码来源:GetCapabilitiesHandler.java

示例10: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
  String name = getRequest().getVariableValue(":name");
  String url = getWebDriver().getCurrentUrl();
  getWebDriver().deleteCookie(name, url);

  Response res = new Response();
  res.setSessionId(getSession().getSessionId());
  res.setStatus(0);
  res.setValue(new JSONObject());
  return res;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:13,代码来源:DeleteCookieByNameHandler.java

示例11: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
  getWebDriver().getContext().newContext();
  getWebDriver().forward();

  Response res = new Response();
  res.setSessionId(getSession().getSessionId());
  res.setStatus(0);
  res.setValue(new JSONObject());
  return res;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:12,代码来源:ForwardHandler.java

示例12: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
  String ref = getRequest().getVariableValue(":reference");
  RemoteWebElement element = getWebDriver().createElement(ref);
  boolean isSelected = element.isSelected();
  Response res = new Response();
  res.setSessionId(getSession().getSessionId());
  res.setStatus(0);
  res.setValue(isSelected);
  return res;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:12,代码来源:IsSelectedHandler.java

示例13: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
  ServerSideSession session = null;
  try {
    JsonObject capsJson = getRequest().getPayload().getJsonObject("desiredCapabilities");
    session = safeStart(new DesiredCapabilities(JavaxJson.toJavaMap(capsJson)));
    if (session == null) {
      throw new SessionNotCreatedException("Failed to start session.");
    }

    Response r = new Response();
    r.setSessionId(session.getSessionId());
    r.setValue(session.getWebDriver().capabilities());
    r.setStatus(0);
    return r;
  } catch (Exception e) {
    logger.atSevere().withCause(e).log();
    if (session != null) {
      session.stop();
    }
    if (e instanceof WebDriverException) {
      throw e;
    } else {
      throw new SessionNotCreatedException(e.getMessage(), e);
    }
  }
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:28,代码来源:NewSessionHandler.java

示例14: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
  String ref = getRequest().getVariableValue(":reference");
  RemoteWebElement element = getWebDriver().createElement(ref);
  element.submit();
  Response res = new Response();
  res.setSessionId(getSession().getSessionId());
  res.setStatus(0);
  res.setValue(new JSONObject());
  return res;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:12,代码来源:SubmitHandler.java

示例15: handle

import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
  String ref = getRequest().getVariableValue(":reference");
  RemoteWebElement element = getWebDriver().createElement(ref);
  boolean isEnabled = element.isEnabled();
  Response res = new Response();
  res.setSessionId(getSession().getSessionId());
  res.setStatus(0);
  res.setValue(isEnabled);
  return res;
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:12,代码来源:IsEnabledHandler.java


注:本文中的org.openqa.selenium.remote.Response.setSessionId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。