Skip to content

Commit b3227f7

Browse files
Quote button name when string
1 parent 0c0073d commit b3227f7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/appium_lib/element/ios/alert.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@
22
if $os == :ios
33
# iOS only
44
# Tap the alert button identified by value.
5+
#
6+
# Click the ok button:
7+
# alert_click 'OK'
8+
#
9+
# Click the first button:
10+
# alert_click 0
11+
#
512
# @param value [Integer, String] either an integer index of the button or the button's name
613
# @return [void]
714
def alert_click value
15+
value = "'#{value}'" if value.is_a?(String)
816
$driver.execute_script "UIATarget.localTarget().frontMostApp().alert().buttons()[#{value}].tap();"
917
end
1018

@@ -46,4 +54,4 @@ def alert_dismiss_text
4654
b.first.text if b && b.size >= 1
4755
end
4856

49-
end # if $os == :ios
57+
end # if $os == :ios

0 commit comments

Comments
 (0)