本文整理汇总了Java中org.openqa.selenium.remote.Response.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Response.getValue方法的具体用法?Java Response.getValue怎么用?Java Response.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openqa.selenium.remote.Response
的用法示例。
在下文中一共展示了Response.getValue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: send
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@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;
}
示例2: execute
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
/**
* This method executes a command supported by Appium JSONWP.
*
* @param commandName a JSONWP command
* @param parameters is a map which contains parameter names as keys and parameter values
* @return a command execution result
*/
public Object execute(String commandName, Map<String, ?> parameters) {
Response response;
if (parameters == null || parameters.isEmpty()) {
response = driver.execute(commandName, ImmutableMap.<String, Object>of());
} else {
response = driver.execute(commandName, parameters);
}
return response.getValue();
}
示例3: getContextHandles
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override public Set<String> getContextHandles() {
Response response = execute(DriverCommand.GET_CONTEXT_HANDLES);
Object value = response.getValue();
try {
List<String> returnedValues = (List<String>) value;
return new LinkedHashSet<>(returnedValues);
} catch (ClassCastException ex) {
throw new WebDriverException(
"Returned value cannot be converted to List<String>: " + value, ex);
}
}
示例4: getAppStringMap
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
/**
* @param language strings language code.
* @param stringFile strings filename.
* @return a map with localized strings defined in the app.
* @see HasAppStrings#getAppStringMap(String, String).
*/
@Override public Map<String, String> getAppStringMap(String language, String stringFile) {
String[] parameters = new String[] {"language", "stringFile"};
Object[] values = new Object[] {language, stringFile};
Response response = execute(
MobileCommand.GET_STRINGS, MobileCommand.prepareArguments(parameters, values));
return (Map<String, String>) response.getValue();
}
示例5: getBrightness
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public int getBrightness() {
Response response = execute("selendroid-getBrightness");
Number value = (Number) response.getValue();
return value.intValue();
}
示例6: getConfiguration
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Map<String, Object> getConfiguration(DriverCommand command) {
Response response =
execute("selendroid-getCommandConfiguration", ImmutableMap.of("command", command.command));
return (Map<String, Object>) response.getValue();
}
示例7: getContextHandles
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public Set<String> getContextHandles() {
Response response = execute(org.openqa.selenium.remote.DriverCommand.GET_CONTEXT_HANDLES);
Object value = response.getValue();
try {
List<String> returnedValues = (List<String>) value;
return new LinkedHashSet<String>(returnedValues);
} catch (ClassCastException ex) {
throw new WebDriverException("Returned value cannot be converted to List<String>: " + value,
ex);
}
}
示例8: readCallLog
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
public List<CallLogEntry> readCallLog() {
Response response = execute("readCallLog");
Object value = response.getValue();
try {
List<String> returnedLogs = (List<String>) value;
List<CallLogEntry> logEntries = new ArrayList<CallLogEntry>(returnedLogs.size());
for (String jsonLogEntry : returnedLogs) {
logEntries.add(CallLogEntry.fromJson(jsonLogEntry));
}
return logEntries;
} catch (ClassCastException ex) {
throw new WebDriverException("Returned value cannot be converted to List<String>: " + value,
ex);
}
}
示例9: callExtension
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
public Object callExtension(String extensionMethod, Map<String, ?> parameters) {
Map<String, Object> paramsWithHandler = Maps.newHashMap();
paramsWithHandler.putAll(parameters);
paramsWithHandler.put("handlerName", extensionMethod);
Response response = execute("selendroid-handleByExtension", paramsWithHandler);
return response.getValue();
}
示例10: getSessionDetails
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
/**
* @return a map with values that hold session details.
*
*/
public Map<String, Object> getSessionDetails() {
Response response = execute(MobileCommand.GET_SESSION);
return (Map<String, Object>) response.getValue();
}
示例11: handleResponse
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
private static <T extends Object> T handleResponse(Response responce) {
if (responce != null) {
return (T) responce.getValue();
}
return null;
}
示例12: getCssValue
import org.openqa.selenium.remote.Response; //导入方法依赖的package包/类
@Override
public String getCssValue(String propertyName) {
Response response = execute("getElementValueOfCssProperty",
ImmutableMap.of("id", id, "propertyName", propertyName));
return ((String) response.getValue());
}