From 0151d5be9e457f43658752dd2493f82b48637bcc Mon Sep 17 00:00:00 2001 From: Liviu Avram <37159441+zastress@users.noreply.github.com> Date: Mon, 29 Apr 2024 09:27:42 +0300 Subject: [PATCH] Added method to click iOS Alert button in Appium v2 (#420) --- AppiumLibrary/keywords/_touch.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/AppiumLibrary/keywords/_touch.py b/AppiumLibrary/keywords/_touch.py index dac3cca..96e210b 100644 --- a/AppiumLibrary/keywords/_touch.py +++ b/AppiumLibrary/keywords/_touch.py @@ -167,6 +167,21 @@ def tap_with_number_of_taps(self, locator, number_of_taps, number_of_touches): params = {'element': element, 'numberOfTaps': number_of_taps, 'numberOfTouches': number_of_touches} driver.execute_script("mobile: tapWithNumberOfTaps", params) + def click_alert_button(self, button_name): + """ Clicks on Alert button identified by Name.iOS only. + + Args: + - ``button_name`` - Text on the iOS alert button. + + Example: + | Click Alert Button | Allow | + + New in AppiumLibrary v2 + """ + driver = self._current_application() + params={'action': 'accept', 'buttonLabel': button_name} + driver.execute_script("mobile: alert", params) + def click_a_point(self, x=0, y=0, duration=100): """*DEPRECATED!!* Since selenium v4, use other keywords.