ByLabel Actions
answerAlert
Description: This function is used to answer the alert present with the expected text.
Input Format : @Expected Text
ObjectName | Action | Input | Condition | Reference | |
---|---|---|---|---|---|
MOBILE | answerAlert |
@value | Hardcoded Input | ||
MOBILE | answerAlert |
Sheet:Column | Input from Datasheet | ||
MOBILE | answerAlert |
%dynamicVar% | Input from variable |
@Action(object = ObjectType.MOBILE, desc = "Answer the alert present with [<Data>]", input = InputType.YES)
public void answerAlert() {
String setAlertText = Data;
try {
mDriver.switchTo().alert().sendKeys(setAlertText);
Report.updateTestLog(Action, "Message '" + setAlertText + "' is set in the alert window", Status.DONE);
} catch (Exception e) {
Report.updateTestLog(Action, e.getMessage(), Status.FAILNS);
Logger.getLogger(CommonMethods.class.getName()).log(Level.SEVERE, null, e);
}
}
acceptAlert
Description: This function is used to accept the alert.
ObjectName | Action | Input | Condition | Reference |
---|---|---|---|---|
MOBILE | acceptAlert |
@Action(object = ObjectType.MOBILE, desc = "Accept the alert present")
public void acceptAlert() {
try {
mDriver.switchTo().alert().accept();
Report.updateTestLog(Action, "Alert is accepted", Status.DONE);
} catch (Exception e) {
Report.updateTestLog(Action, e.getMessage(), Status.FAILNS);
Logger.getLogger(CommonMethods.class.getName()).log(Level.SEVERE, null, e);
}
}
dismissAlert
Description: This function is used to dismiss the alert.
ObjectName | Action | Input | Condition | Reference |
---|---|---|---|---|
MOBILE | dismissAlert |
@Action(object = ObjectType.MOBILE, desc = "Dismiss the alert present")
public void dismissAlert() {
try {
mDriver.switchTo().alert().dismiss();
Report.updateTestLog(Action, "Alert is dismissed", Status.DONE);
} catch (Exception e) {
Report.updateTestLog(Action, e.getMessage(), Status.FAILNS);
Logger.getLogger(CommonMethods.class.getName()).log(Level.SEVERE, null, e);
}
}