本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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;
}
示例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;
}