本文整理汇总了Java中org.openqa.selenium.remote.Response.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java Response.setValue方法的具体用法?Java Response.setValue怎么用?Java Response.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.selenium.remote.Response
的用法示例。
在下文中一共展示了Response.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
WebDriverLikeCommand command =
WebDriverLikeCommand.valueOf(getRequest().getVariableValue(":command"));
JSONObject payload = JavaxJson.toOrgJson(getRequest().getPayload());
@SuppressWarnings("unchecked")
Iterator<String> iter = payload.keys();
while (iter.hasNext()) {
String key = iter.next();
Object value = payload.opt(key);
getSession().configure(command).set(key, value);
}
Response resp = new Response();
resp.setSessionId(getSession().getSessionId());
resp.setStatus(0);
resp.setValue(new JSONObject());
return resp;
}
示例2: 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;
}
示例3: handle
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
String name = getRequest().getVariableValue(":command");
WebDriverLikeCommand command = WebDriverLikeCommand.valueOf(name);
CommandConfiguration conf = getSession().configure(command);
JSONObject res = new JSONObject();
Map<String, Object> m = conf.getAll();
for (String key : m.keySet()) {
res.put(key, m.get(key));
}
Response resp = new Response();
resp.setSessionId(getSession().getSessionId());
resp.setStatus(0);
resp.setValue(res);
return resp;
}
示例4: 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;
}
示例5: handle
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
Response response = new Response();
response.setStatus(ErrorCodes.SUCCESS);
response.setState(ErrorCodes.SUCCESS_STRING);
BuildInfo buildInfo = new BuildInfo();
JsonObject info = new JsonObject();
JsonObject build = new JsonObject();
build.addProperty("version", buildInfo.getReleaseLabel());
build.addProperty("revision", buildInfo.getBuildRevision());
build.addProperty("time", buildInfo.getBuildTime());
info.add("build", build);
JsonObject os = new JsonObject();
os.addProperty("name", System.getProperty("os.name"));
os.addProperty("arch", System.getProperty("os.arch"));
os.addProperty("version", System.getProperty("os.version"));
info.add("os", os);
JsonObject java = new JsonObject();
java.addProperty("version", System.getProperty("java.version"));
info.add("java", java);
response.setValue(info);
return response;
}
示例6: 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;
}
示例7: handle
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
String ref = getRequest().getVariableValue(":reference");
RemoteWebElement element = getWebDriver().createElement(ref);
String text = element.getText();
Response res = new Response();
res.setSessionId(getSession().getSessionId());
res.setStatus(0);
res.setValue(text);
return res;
}
示例8: 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;
}
示例9: 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().getSize());
return res;
}
示例10: handle
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
String url = getWebDriver().getCurrentUrl();
List<Cookie> cookies = getWebDriver().getCookies();
for (Cookie c : cookies) {
getWebDriver().deleteCookie(c.getName(), 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 {
Set<String> handles = new HashSet<>();
for (PageId pageId : getWebDriver().listPages()) {
handles.add(pageId.asString());
}
Response resp = new Response();
resp.setSessionId(getSession().getSessionId());
resp.setStatus(0);
resp.setValue(handles);
return resp;
}
示例12: 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;
}
示例13: handle
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Response handle() throws Exception {
String ref = getRequest().getVariableValue(":reference");
RemoteWebElement element = getWebDriver().createElement(ref);
Dimension size = element.getSize();
Response res = new Response();
res.setSessionId(getSession().getSessionId());
res.setStatus(0);
res.setValue(size);
return res;
}
示例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);
boolean isSelected = element.isSelected();
Response res = new Response();
res.setSessionId(getSession().getSessionId());
res.setStatus(0);
res.setValue(isSelected);
return res;
}
示例15: 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;
}