Skip to content

Commit 1f72729

Browse files
switch_to.alert calls getAlertText so use bridge directly
1 parent 9752a3b commit 1f72729

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/appium_lib/ios/element/alert.rb

+10-3
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,18 @@ def alert_click value
1919
# Get the alert message text.
2020
# @return [String]
2121
def alert_text
22-
@driver.switch_to.alert.text
22+
# this will call get text twice so call bridge directly
23+
# ".switch_to.alert" calls it once, then ".text" another time.
24+
# @driver.switch_to.alert.text
25+
driver.send(:bridge).getAlertText
2326
end
2427

2528
# Accept the alert.
2629
# @return [void]
2730
def alert_accept
28-
@driver.switch_to.alert.accept
31+
# @driver.switch_to.alert.accept
32+
# ".switch_to.alert" calls getAlertText so use bridge directly
33+
driver.send(:bridge).acceptAlert
2934
end
3035

3136
# Get the text of the alert's accept button.
@@ -41,7 +46,9 @@ def alert_accept_text
4146
# Dismiss the alert.
4247
# @return [void]
4348
def alert_dismiss
44-
@driver.switch_to.alert.dismiss
49+
# @driver.switch_to.alert.dismiss
50+
# ".switch_to.alert" calls getAlertText so use bridge directly
51+
driver.send(:bridge).dismissAlert
4552
end
4653

4754
# Get the text of the alert's dismiss button.

0 commit comments

Comments
 (0)