appium-uiautomator2-driver
Version:
UiAutomator2 integration for Appium
41 lines • 1.45 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAlertText = getAlertText;
exports.mobileAcceptAlert = mobileAcceptAlert;
exports.postAcceptAlert = postAcceptAlert;
exports.mobileDismissAlert = mobileDismissAlert;
exports.postDismissAlert = postDismissAlert;
/**
* Gets the text of the currently displayed alert.
* @returns The alert text as a string.
*/
async function getAlertText() {
return String(await this.uiautomator2.jwproxy.command('/alert/text', 'GET', {}));
}
/**
* Accepts the currently displayed alert.
* @param buttonLabel - Optional label of the button to click. If not provided, the button will be detected automatically.
*/
async function mobileAcceptAlert(buttonLabel) {
await this.uiautomator2.jwproxy.command('/alert/accept', 'POST', { buttonLabel });
}
/**
* Accepts the currently displayed alert (W3C endpoint).
*/
async function postAcceptAlert() {
await this.mobileAcceptAlert();
}
/**
* Dismisses the currently displayed alert.
* @param buttonLabel - Optional label of the button to click. If not provided, the button will be detected automatically.
*/
async function mobileDismissAlert(buttonLabel) {
await this.uiautomator2.jwproxy.command('/alert/dismiss', 'POST', { buttonLabel });
}
/**
* Dismisses the currently displayed alert (W3C endpoint).
*/
async function postDismissAlert() {
await this.mobileDismissAlert();
}
//# sourceMappingURL=alert.js.map