SeeTestAutomation- GetLastCommandResultMap
Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .
Note: This command can only be added in the code environment (excpet UFT), and not in SeeTestAutomation
Description
This command can be used to retrieve information (of all parameters listed below) on the last command which was executed.
This command can be also useful while generating reports to an external reports system.
Parameters
The following keys can be found in the map:
-
package - String, Package name of last installed app
-
position - element position (upper left corner of the element)
-
WinTitle - active device the action was made on
-
status - Boolean, indicates if a command succeed or not
-
dtime - the time of a command execution
-
width - width of the element
-
height - height of the element
-
click - click coordinates on click elements
-
img.height - height of the report image
-
img.width - width of the report image
-
screen.height - height of the screen
-
screen.width - width of the screen
-
logLine - string, summarizes the last command
-
outFile - string, with the path to an image of the report
-
time - time from command to operation
-
bcolor.name - background color name (TEXT Zone only)
-
bcolor - background color value (TEXT Zone only)
-
color - text color value (TEXT Zone only)
-
color.name - text color name (TEXT Zone only)
-
font.size - font size (TEXT Zone only)
-
step - index of command step in the test
-
found - Boolean, verification of element
-
keys - when command fails to execute
-
errorMessage - string, the error indication
-
exception - string, the exception stack trace (optional)
Note: " TEXT Zone only" means that the key will return values only for objects recognized using OCR (Zone TEXT). Those keys will not work for objects recognized using other identification methods (NATIVE/WEB).
Usage
Example script
Description: On the following Java snippet we will get the status of the isElementFound command
Java Example
client.isElementFound("NATIVE", "text=login", 0);
Map <String, Object> map = client.getLastCommandResultMap();
String commandStatus= (String) map.get("status");
How to get element font size for Android Devices:
AndroidGetFontSize Expand source
// Please change the code for your needs
private double getFontSize(String elementXpath){
final double MEDIUM_DENSITY = 160.0;// Use YOUR device text density
final String density = client.run("adb shell wm density");
final double screenDensity = Double.parseDouble(density.trim().split(":")[1]);
final double scaledDens = screenDensity/MEDIUM_DENSITY;
final double pixelSize = Double.parseDouble(client.runNativeAPICall("NATIVE", elementXpath, 0, "view" + ".getTextSize();"));
return pixelSize/scaledDens;
}