mirror of
https://github.com/appium/appium.git
synced 2026-04-26 13:28:43 -05:00
Fix acceptAlert for UICatalog on iOS 7
This commit is contained in:
@@ -928,19 +928,35 @@ $.extend(au, {
|
||||
|
||||
, acceptAlert: function() {
|
||||
var alert = this.mainApp.alert();
|
||||
var acceptButton = alert.defaultButton();
|
||||
var buttonCount = alert.buttons().length;
|
||||
if (acceptButton.isNil() && buttonCount > 0) {
|
||||
// last button is accept
|
||||
acceptButton = alert.buttons()[buttonCount - 1];
|
||||
}
|
||||
if (!alert.isNil()) {
|
||||
var acceptButton = alert.defaultButton();
|
||||
var buttonCount = alert.buttons().length;
|
||||
if (acceptButton.isNil() && buttonCount > 0) {
|
||||
// last button is accept
|
||||
acceptButton = alert.buttons()[buttonCount - 1];
|
||||
}
|
||||
|
||||
acceptButton.tap();
|
||||
this.waitForAlertToClose(alert);
|
||||
return {
|
||||
status: codes.Success.code,
|
||||
value: null
|
||||
};
|
||||
acceptButton.tap();
|
||||
this.waitForAlertToClose(alert);
|
||||
return {
|
||||
status: codes.Success.code,
|
||||
value: null
|
||||
};
|
||||
} else {
|
||||
var ios7AlertButtons = this._getElementsByXpath("actionsheet/button");
|
||||
if (ios7AlertButtons.length > 0) {
|
||||
ios7AlertButtons[0].tap();
|
||||
return {
|
||||
status: codes.Success.code,
|
||||
value: null
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
status: status.codes.UnknownError.code,
|
||||
value: null
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
, alertIsPresent: function() {
|
||||
|
||||
Reference in New Issue
Block a user