Module: Appium::Ios::Xcuitest::Gesture
- Defined in:
- lib/appium_lib/ios/xcuitest/command/gestures.rb
Instance Method Summary collapse
-
#alert(action:, button_label: nil) ⇒ Object
{} or Selenium::WebDriver::Error::NoSuchAlertError if no action sheet or alert or button labels if action is equal to getButtons.
- #double_tap(x: nil, y: nil, element: nil) ⇒ Object
-
#drag_from_to_for_duration(from_x:, from_y:, to_x:, to_y:, duration: 1.0, element: nil) ⇒ Object
rubocop:disable Metrics/ParameterLists.
- #one_finger_tap(x:, y:, element: nil) ⇒ Object
- #pinch(scale:, velocity: 1.0, element: nil) ⇒ Object
-
#scroll(direction:, distance: nil, name: nil, element: nil, to_visible: nil, predicate_string: nil) ⇒ Object
rubocop:disable Metrics/ParameterLists.
- #select_picker_wheel(element:, order:, offset: nil) ⇒ Object
- #swipe(direction:, element: nil) ⇒ Object
- #touch_and_hold(x: nil, y: nil, element: nil, duration: 1.0) ⇒ Object
- #two_finger_tap(element:) ⇒ Object
Instance Method Details
#alert(action:, button_label: nil) ⇒ Object
Returns {} or Selenium::WebDriver::Error::NoSuchAlertError if no action sheet or alert or button labels if action is equal to getButtons.
“‘ruby alert action: “accept” alert action: “dismiss” “`.
182 183 184 185 186 187 188 |
# File 'lib/appium_lib/ios/xcuitest/command/gestures.rb', line 182 def alert(action:, button_label: nil) return 'Set "accept", "dismiss" or "getButtons" for :action' unless %w(accept dismiss getButtons).include?(action) args = { action: action } args[:button_label] if @driver.execute_script 'mobile: alert', args end |
#double_tap(x: nil, y: nil, element: nil) ⇒ Object
82 83 84 85 86 87 |
# File 'lib/appium_lib/ios/xcuitest/command/gestures.rb', line 82 def double_tap(x: nil, y: nil, element: nil) return 'Set x, y or element' if (x.nil? || y.nil?) && element.nil? args = element.nil? ? { x: x, y: y } : { element: element.id } @driver.execute_script 'mobile: doubleTap', args end |
#drag_from_to_for_duration(from_x:, from_y:, to_x:, to_y:, duration: 1.0, element: nil) ⇒ Object
rubocop:disable Metrics/ParameterLists
147 148 149 150 151 |
# File 'lib/appium_lib/ios/xcuitest/command/gestures.rb', line 147 def drag_from_to_for_duration(from_x:, from_y:, to_x:, to_y:, duration: 1.0, element: nil) args = { fromX: from_x, fromY: from_y, toX: to_x, toY: to_y, duration: duration } args[:element] = element.id if element @driver.execute_script 'mobile: dragFromToForDuration', args end |
#one_finger_tap(x:, y:, element: nil) ⇒ Object
127 128 129 130 131 |
# File 'lib/appium_lib/ios/xcuitest/command/gestures.rb', line 127 def one_finger_tap(x:, y:, element: nil) args = { x: x, y: y } args[:element] = element.id if element @driver.execute_script 'mobile: tap', args end |
#pinch(scale:, velocity: 1.0, element: nil) ⇒ Object
67 68 69 70 71 72 |
# File 'lib/appium_lib/ios/xcuitest/command/gestures.rb', line 67 def pinch(scale:, velocity: 1.0, element: nil) args = { scale: scale, velocity: velocity } args[:element] = element.id if element @driver.execute_script 'mobile: pinch', args end |
#scroll(direction:, distance: nil, name: nil, element: nil, to_visible: nil, predicate_string: nil) ⇒ Object
rubocop:disable Metrics/ParameterLists
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/appium_lib/ios/xcuitest/command/gestures.rb', line 46 def scroll(direction:, distance: nil, name: nil, element: nil, to_visible: nil, predicate_string: nil) return 'Set "up", "down", "left" or "right" for :direction' unless %w(up down left right).include?(direction) args = { direction: direction } args[:element] = element.id if element args[:distance] = distance if distance args[:name] = name if name args[:toVisible] = to_visible if to_visible args[:predicateString] = predicate_string if predicate_string @driver.execute_script 'mobile: scroll', args end |
#select_picker_wheel(element:, order:, offset: nil) ⇒ Object
164 165 166 167 168 169 170 |
# File 'lib/appium_lib/ios/xcuitest/command/gestures.rb', line 164 def select_picker_wheel(element:, order:, offset: nil) return 'Set "next" or "previous" for :order' unless %w(next previous).include?(order) args = { element: element.id, order: order } args[:offset] = offset if offset @driver.execute_script 'mobile: selectPickerWheelValue', args end |
#swipe(direction:, element: nil) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/appium_lib/ios/xcuitest/command/gestures.rb', line 25 def swipe(direction:, element: nil) args = { direction: direction } args[:element] = element.id if element @driver.execute_script 'mobile: swipe', args end |
#touch_and_hold(x: nil, y: nil, element: nil, duration: 1.0) ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/appium_lib/ios/xcuitest/command/gestures.rb', line 99 def touch_and_hold(x: nil, y: nil, element: nil, duration: 1.0) return 'Set x, y or element' if (x.nil? || y.nil?) && element.nil? args = element.nil? ? { x: x, y: y } : { element: element.id } args[:duration] = duration @driver.execute_script 'mobile: touchAndHold', args end |
#two_finger_tap(element:) ⇒ Object
112 113 114 115 |
# File 'lib/appium_lib/ios/xcuitest/command/gestures.rb', line 112 def two_finger_tap(element:) args = { element: element.id } @driver.execute_script 'mobile: twoFingerTap', args end |