本文整理汇总了Java中org.openqa.selenium.remote.Response.setState方法的典型用法代码示例。如果您正苦于以下问题:Java Response.setState方法的具体用法?Java Response.setState怎么用?Java Response.setState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.selenium.remote.Response
的用法示例。
在下文中一共展示了Response.setState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: success
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
/**
* Creates a response object for a successful command execution.
*
* @param sessionId ID of the session that executed the command.
* @param value the command result value.
* @return the new response object.
*/
public static Response success(SessionId sessionId, Object value) {
Response response = new Response();
response.setSessionId(sessionId != null ? sessionId.toString() : null);
response.setValue(value);
response.setStatus(ErrorCodes.SUCCESS);
response.setState(ErrorCodes.SUCCESS_STRING);
return response;
}
示例3: failure
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
/**
* Creates a response object for a failed command execution.
*
* @param sessionId ID of the session that executed the command.
* @param reason the failure reason.
* @return the new response object.
*/
public static Response failure(SessionId sessionId, Throwable reason) {
Response response = new Response();
response.setSessionId(sessionId != null ? sessionId.toString() : null);
response.setValue(reason);
response.setStatus(ERROR_CODES.toStatusCode(reason));
response.setState(ERROR_CODES.toState(response.getStatus()));
return response;
}