use of io.appium.java_client.MobileCommand.GET_SESSION in project java-client by appium.
the class HasSessionDetails method getSessionDetails.
/**
* The current session details.
*
* @return a map with values that hold session details.
*/
@SuppressWarnings("unchecked")
default Map<String, Object> getSessionDetails() {
Response response = execute(GET_SESSION);
Map<String, Object> resultMap = Map.class.cast(response.getValue());
// results of further operations should be simply interpreted by users
return ImmutableMap.<String, Object>builder().putAll(resultMap.entrySet().stream().filter(entry -> {
String key = entry.getKey();
Object value = entry.getValue();
return !isBlank(key) && value != null && !isBlank(String.valueOf(value));
}).collect(toMap(Map.Entry::getKey, Map.Entry::getValue))).build();
}
Aggregations