XCUITest Mobile Gestures

Go back to tutorial

XCUITest Mobile Gestures

Let us now learn more about XCUITest Mobile Gestures. So before we begin, we all know that Apple’s XCTest framework does not natively support W3C standards for TouchAction interface implementation. Although, it provides rich set of gestures, including these, that are unique for iOS platform. It is possible to directly invoke these gestures in Appium. It is important to remember that XCTest and WDA are being constantly changed. This means all “mobile: *” commands can be also subject of change in Appium without any preliminary notice.

mobile: swipe

Supported arguments

  • direction: Either ‘up’, ‘down’, ‘left’ or ‘right’. The parameter is mandatory
  • element: The internal element identifier (as hexadecimal hash string) to swipe on. Application element will be used instead if this parameter is not provided

mobile: scroll

Scrolls the element or the whole screen. Different scrolling strategies are supported. Arguments define the choosen strategy: either ‘name’, ‘direction’, ‘predicateString’ or ‘toVisible’ in that order. Although, there is one known limitation there: in case it is necessary to perform too many scroll gestures on parent container to reach the necessary child element (tens of them) then the method call may fail.

Supported arguments

  • element
  • name
  • direction
  • predicateString
  • toVisible

mobile: doubleTap

Performs double tap gesture on the given element or on the screen.

Supported arguments

  • element
  • x: Screen x tap coordinate of type float.
  • y: Screen y tap coordinate of type float.

mobile: touchAndHold

Performs long press gesture on the given element or on the screen.

Supported arguments

  • element
  • duration
  • x: Screen x long tap coordinate of type float.
  • y: Screen y long tap coordinate of type float.

mobile: twoFingerTap

Performs two finger tap gesture on the given element or on the application element.

Supported arguments

  • element

mobile: tap

Performs tap gesture by coordinates on the given element or on the screen.

Supported arguments

  • element
  • x: x tap coordinate of type float. Mandatory parameter
  • y: y tap coordinate of type float. Mandatory parameter

 

mobile: dragFromToForDuration

Performs drag and drop gesture by coordinates. This can be done either on an element or on the screen

Supported arguments

  • element
  • duration
  • fromX: The x coordinate of starting drag point (type float). Mandatory parameter
  • fromY: The y coordinate of starting drag point (type float). Mandatory parameter
  • toX: The x coordinate of ending drag point (type float). Mandatory parameter
  • toY: The y coordinate of ending drag point (type float). Mandatory parameter

mobile: selectPickerWheelValue

Performs selection of the next or previous picker wheel value. This might be useful if these values are populated dynamically, so you don’t know which one to select or value selection does not work because of XCTest bug.

Supported arguments

  • element
  • order
  • offset

mobile: alert

Performs operations on NSAlert instance.

Supported arguments

  • action
  • buttonLabel

 

Enrich your profile and become Job Ready. Practice and Prepare for Mobile Testing (Appium) Exam Now!

Get expert advice and hundreds of Free Test – Try Mobile Testing (Appium) Practice Questions Now!

Go back to tutorial

Appium XCUITest Driver Setup
UIAutomation Driver for iOS

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?