Set Actions
Set
Description: This function is used to set the value.
Input Format : @Expected Text
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | Set |
@value | |||
mobileObject | Set |
Sheet:Column | |||
mobileObject | Set |
%dynamicVar% |
@Action(object = ObjectType.APP, desc = "Enter the value [<Data>] in the Field [<Object>]", input = InputType.YES)
public void Set() {
if (elementEnabled()) {
Element.clear();
Element.sendKeys(Data);
Report.updateTestLog(Action, "Entered Text '" + Data + "' on '"
+ ObjectName + "'", Status.DONE);
} else {
throw new ElementException(ExceptionType.Element_Not_Enabled, ObjectName);
}
}
SetIfExists
Description: This function is used to set the value if the element exists.
Input Format : @Expected Text
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | SetIfExists |
@value | |||
mobileObject | SetIfExists |
Sheet:Column | |||
mobileObject | SetIfExists |
%dynamicVar% |
SetAndCheck
Description: This function is used to set the value and check the expected text matches with element value.
Input Format : @Expected Text
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | SetAndCheck |
@value | |||
mobileObject | SetAndCheck |
Sheet:Column | |||
mobileObject | SetAndCheck |
%dynamicVar% |
@Action(object = ObjectType.APP, desc = "Enter the value [<Data>] in the Field [<Object>] and check [<Data>] matches with [<Object>] value", input = InputType.YES)
public void SetAndCheck() {
if (elementEnabled()) {
Element.clear();
Element.sendKeys(Data);
if (Element.getAttribute("value").equals(Data)) {
Report.updateTestLog("Set", "Entered Text '" + Data + "' on '"
+ ObjectName + "'", Status.DONE);
} else {
Report.updateTestLog("Set", "Unable Enter Text '" + Data
+ "' on '" + ObjectName + "'", Status.FAIL);
}
} else {
throw new ElementException(ExceptionType.Element_Not_Enabled, ObjectName);
}
}
setEncrypted
Description: This function is used to set an encrypted data to an element.
Input Format : @Expected encrypted text
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | setEncrypted |
@value | |||
mobileObject | setEncrypted |
Sheet:Column | |||
mobileObject | setEncrypted |
%dynamicVar% |
@Action(object = ObjectType.APP, desc = "Enter the Decrypted value [<Data>] in the Field [<Object>]", input = InputType.YES)
public void setEncrypted() {
if (Data != null && Data.matches(".* Enc")) {
if (elementEnabled()) {
try {
Element.clear();
Data = Data.substring(0, Data.lastIndexOf(" Enc"));
byte[] valueDecoded = Encryption.getInstance().decrypt(Data).getBytes();
Element.sendKeys(new String(valueDecoded));
Report.updateTestLog(Action, "Entered Encrypted Text " + Data + " on " + ObjectName, Status.DONE);
} catch (Exception ex) {
Report.updateTestLog("setEncrypted", ex.getMessage(), Status.FAIL);
Logger.getLogger(Basic.class.getName()).log(Level.SEVERE, null, ex);
}
} else {
throw new ElementException(ExceptionType.Element_Not_Enabled, ObjectName);
}
} else {
Report.updateTestLog(Action, "Data not encrypted '" + Data + "'", Status.DEBUG);
}
}
setElementTimeOut
Description: This function is used to change default element finding wait time by input data in seconds
Input Format : @Expected data in seconds
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
Mobile | setElementTimeOut |
@value | |||
Mobile | setElementTimeOut |
Sheet:Column | |||
Mobile | setElementTimeOut |
%dynamicVar% |
@Action(object = ObjectType.MOBILE, desc = "Change Default Element finding wait time by [<Data>] seconds",
input = InputType.YES)
public void setElementTimeOut() {
if (Data != null && Data.matches("[0-9]+")) {
SystemDefaults.elementWaitTime = Duration.ofSeconds(Integer.valueOf(Data));
Report.updateTestLog(Action, "Element Wait time changed to "
+ Data + " second/s", Status.DONE);
} else {
Report.updateTestLog(Action,
"Couldn't change Element Wait time (invalid input) " + Data,
Status.DEBUG);
}
}
setInputByLabel
Description: This function is used to set the expected text to an input element that is adjacent to the provided label element.
Input Format : @Expected Text
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | setInputByLabel |
@value | |||
mobileObject | setInputByLabel |
Sheet:Column | |||
mobileObject | setInputByLabel |
%dynamicVar% |
set_Relative
Description: This function will set given data from input column on element based on parent object
Input Format : @Expected Text
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
mobileObject | set_Relative |
@Data | PageName | << Hardcoded Input | |
mobileObject | set_Relative |
DatasheetName:ColumnName | PageName | << Input from Datasheet | |
mobileObject | set_Relative |
%variableName% | PageName | <<Input from variable |