Skip to content

Commit 0151d5b

Browse files
authored
Added method to click iOS Alert button in Appium v2 (#420)
1 parent 7d73968 commit 0151d5b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

AppiumLibrary/keywords/_touch.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,21 @@ def tap_with_number_of_taps(self, locator, number_of_taps, number_of_touches):
167167
params = {'element': element, 'numberOfTaps': number_of_taps, 'numberOfTouches': number_of_touches}
168168
driver.execute_script("mobile: tapWithNumberOfTaps", params)
169169

170+
def click_alert_button(self, button_name):
171+
""" Clicks on Alert button identified by Name.iOS only.
172+
173+
Args:
174+
- ``button_name`` - Text on the iOS alert button.
175+
176+
Example:
177+
| Click Alert Button | Allow |
178+
179+
New in AppiumLibrary v2
180+
"""
181+
driver = self._current_application()
182+
params={'action': 'accept', 'buttonLabel': button_name}
183+
driver.execute_script("mobile: alert", params)
184+
170185
def click_a_point(self, x=0, y=0, duration=100):
171186
"""*DEPRECATED!!* Since selenium v4, use other keywords.
172187

0 commit comments

Comments
 (0)