Skip to content

Commit

Permalink
Added method to click iOS Alert button in Appium v2 (#420)
Browse files Browse the repository at this point in the history
  • Loading branch information
zastress authored Apr 29, 2024
1 parent 7d73968 commit 0151d5b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions AppiumLibrary/keywords/_touch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0151d5b

Please sign in to comment.