lib/appium_lib/ios/xcuitest/command/gestures.rb in appium_lib-11.2.0 vs lib/appium_lib/ios/xcuitest/command/gestures.rb in appium_lib-12.0.0.rc1
- old
+ new
@@ -22,11 +22,11 @@
# ```ruby
# swipe direction: "down"
# ```
def swipe(direction:, element: nil)
args = { direction: direction }
- args[:element] = element.ref if element
+ args[:element] = element.id if element
@driver.execute_script 'mobile: swipe', args
end
# @param [string] direction Either 'up', 'down', 'left' or 'right'.
@@ -45,11 +45,11 @@
# rubocop:disable Metrics/ParameterLists
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.ref if element
+ 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
@@ -64,11 +64,11 @@
# ```ruby
# pinch scale: 0.5, velocity: -1
# ```
def pinch(scale:, velocity: 1.0, element: nil)
args = { scale: scale, velocity: velocity }
- args[:element] = element.ref if element
+ args[:element] = element.id if element
@driver.execute_script 'mobile: pinch', args
end
# @param x [float] X Screen x tap coordinate of type float. Mandatory parameter only if element is not set
@@ -80,11 +80,11 @@
# double_tap element: find_element(:accessibility_id, "some item")
# ```
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.ref }
+ args = element.nil? ? { x: x, y: y } : { element: element.id }
@driver.execute_script 'mobile: doubleTap', args
end
# @param x [float] Screen x long tap coordinate of type float. Mandatory parameter only if element is not set
# @param y [float] Screen y long tap coordinate of type float. Mandatory parameter only if element is not set
@@ -97,22 +97,22 @@
# touch_and_hold element: find_element(:accessibility_id, "some item")
# ```
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.ref }
+ args = element.nil? ? { x: x, y: y } : { element: element.id }
args[:duration] = duration
@driver.execute_script 'mobile: touchAndHold', args
end
# @param [Element] element Element to long tap on.
#
# ```ruby
# two_finger_tap element: find_element(:accessibility_id, "some item")
# ```
def two_finger_tap(element:)
- args = { element: element.ref }
+ args = { element: element.id }
@driver.execute_script 'mobile: twoFingerTap', args
end
# @param x [float] X tap coordinate of type float. Mandatory parameter
# @param y [float] Y tap coordinate of type float. Mandatory parameter
@@ -124,11 +124,11 @@
# one_finger_tap x: 100, y: 100
# one_finger_tap x: 100, y: 100, element: find_element(:accessibility_id, "some item")
# ```
def one_finger_tap(x:, y:, element: nil)
args = { x: x, y: y }
- args[:element] = element.ref if element
+ args[:element] = element.id if element
@driver.execute_script 'mobile: tap', args
end
# rubocop:disable Metrics/ParameterLists
# @param duration [float] Float number of seconds in range [0.5, 60]. How long the tap gesture at starting
@@ -144,11 +144,11 @@
# ```ruby
# drag_from_to_for_duration from_x: 100, from_y: 100, to_x: 150, to_y: 150
# ```
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.ref if element
+ args[:element] = element.id if element
@driver.execute_script 'mobile: dragFromToForDuration', args
end
# rubocop:enable Metrics/ParameterLists
# https://github.com/facebook/WebDriverAgent/pull/523
@@ -162,10 +162,10 @@
# select_picker_wheel order: "next", element: find_element(:accessibility_id, "some picker")
# ```
def select_picker_wheel(element:, order:, offset: nil)
return 'Set "next" or "previous" for :order' unless %w(next previous).include?(order)
- args = { element: element.ref, order: order }
+ args = { element: element.id, order: order }
args[:offset] = offset if offset
@driver.execute_script 'mobile: selectPickerWheelValue', args
end
# @param action [String] The following actions are supported: accept, dismiss and getButtons. Mandatory parameter