iOS-Specific Touch Action Methods

April 24, 2026 · 10 min read · Mobile Testing

HeadSpin Platform
Automated & amp; manual testing make easy through data science insights.
Differentiating potentiality:
  • Extensive end-to-end automation of QA process
  • Relative analysis of app performance against compeer
  • Continuous monitoring of app performance using synthetic data for high availability of apps
  • Easy-to-use developer friendly platform
cloudtest go
Low-cost Existent Device Testing for Emerging Teams
cloudtest go
Affordable Existent Device Testing for Digital Enterprises
cloudtest go
The Ultimate Solution for a Powerful Blend of Functional & amp; Performance Testing!
cyol
TEM
New
Centralized wandering test executing in cloud
cyol
Enhance Your Accessibility Testing With HeadSpin
cyol
Automate camera-based testing

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

retail

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

iOS-Specific Touch Action MethodsiOS-Specific Touch Action Methods

iOS-Specific Touch Action Methods

Published on
August 15, 2018
Updated on
Published on
May 31, 2022
Updated on
 by 
 Jonathan LippsJonathan Lipps
Jonathan Lipps

In a previous edition of Appium Pro, we saw how to to automate complex motion, including drawing some (nonplus) stick soma art. The like API can obviously execute elementary gestures like nobble, pinching, and surge. However, there & # x27; s occasionally a downside to apply these general method, which is that they bypass the officially-recognized APIs for standard complex actions provide by the underlying, for example iOS.

If you ever run into trouble using the W3C Action API, Appium furnish direct access to these vendor-supported action methods as well. In this article we & # x27; ll take a look at the ones available for iOS. Because these are not part of the WebDriver spec, Appium furnish this access by clog theexecuteScriptcommand, as you & # x27; ll see in the instance below.

mobile: swipe

This command ultimately calls theXCUIElement.swipe *house of method provided by XCUITest, and thus takes two argument: a way (whether to swipe up, down, left, or right), and the ID of an factor within which the swipe is to conduct place (Appium defaults to the entire Application element if no element is specify).

Note: for this bid and all othermobile:commands which have an element as a argument, the value which should be supplied is theinternal IDof the element, which is not normally needed as piece of Selenium/Appium prove. To get it in the Java customer, you can callelement.getID ()(potentially needing to castelement to RemoteWebElement first).

Example:

// swipe up then down Mapargs = new HashMap < > (); args.put (`` direction '', `` up ''); driver.executeScript (`` mobile: swipe '', args); args.put (`` direction '', `` down ''); driver.executeScript (`` mobile: swipe '', args);

Unfortunately, XCUITest does not render any parameters to modify the hurrying or length of the swipe. For that, use the more general Actions API.

mobile: whorl

If you want to try and make sure that each motion of your gesture moves a vista by the superlative of the scrollable content, or if you desire to scroll until a especial element is visible, trymobile: scroll. It works similarly tomobile: swipebut takes more parameters:

  • element:the id of the element to scroll within (the coating factor by default). Call this the & quot; restrict element & quot;
  • direction:the opposite of how direction is used inmobile: swipe. A swipe & quot; up & quot; will scroll prospect contents down, whereas this is what a scroll & quot; down & quot; will do.
  • name:the accessibility ID of an element to scroll to within the bounding element
  • predicateString:the NSPredicate of an element to scroll to within the bounding component
  • toVisible: if true, and if element is set to a custom element, so simply scroll to the first visible tyke ofelement

Example:

// scroll downward then up Mapargs = new HashMap < > (); args.put (`` direction '', `` down ''); driver.executeScript (`` mobile: scroll '', args); args.put (`` direction '', `` up ''); driver.executeScript (`` mobile: scroll '', args); // scroll to the last point in the leaning by accessibility id args.put (`` direction '', `` downward ''); args.put (`` name '', `` Stratus ''); driver.executeScript (`` mobile: scroll '', args); // scroll backward to the first detail in the lean MobileElement list = (MobileElement) driver.findElement (By.className (`` XCUIElementTypeScrollView '')); args.put (`` direction '', `` up ''); args.put (`` name '', null); args.put (`` element '', list.getId ()); driver.executeScript (`` mobile: coil '', args);
mobile: tinge

To swipe (described by a two-finger gesture where the fingerbreadth start far apart and come together) or to zoom (described by the inverse gesture where fingers part together and expand outward), usemobile: pinch, which callXCUIElement.pinchunder the hood. As with the early methods described so far, you can pass in anelementparameter defining the element in which the pinch will take place (the total covering by default).

SUSA automates exploratory testing with persona-driven behavior, catching bugs that scripted automation misses.

The only required parameter isscale:

  • Values between 0 and 1 refer to a & quot; pinch & quot;
  • Values greater than 1 refer to a & quot; zoom & quot;

An additional optional argumentvelocity can be sent, which corresponds to & quot; the velocity of the soupcon in scale constituent per second & quot; concord toApple & # x27; s docs.

Example:

// zoom in on something Mapargs = new HashMap < > (); args.put (`` scale '', 5); driver.executeScript (`` mobile: pinch '', args);
mobile: tap

The better way to tap on an element is usingelement.click (). So why do we havemobile: tap? This method let for extra parametersx and ysignifying the co-ordinate at which to click. The decent thing is that this coordinate is either screen-relative (if anelementargument is not included, the default), or element-relative (if an element argument is included).

This imply that if you want to tap at the very top left corner of an element kinda than dead heart, you can!

Example:

// tap an element very near its top left corner Mapargs = new HashMap < > (); args.put (`` element '', ((MobileElement) element) .getId ()); args.put (`` x '', 2); args.put (`` y '', 2); driver.executeScript (`` mobile: tap '', args);
mobile: doubleTap

There & # x27; s more to tap than single-tapping! And while you can certainly build a double-tap option using the Actions API, XCUITest cater aXCUIElement.doubleTapmethod for this role, and it could presumably hold great reliability than synthesizing your own action.

In terms of parameters, you should mail ineither an element parameter, with the ID of the element you want to tap,or both an x and yvalue representing the screen coordinate you wish to tap.

Example:

// double-tap the screen at a specific point Mapargs = new HashMap < > (); args.put (`` x '', 100); args.put (`` y '', 200); driver.executeScript (`` mobile: doubleTap '', args);
mobile: twoFingerTap

Not to be discombobulate with a double-tap, a two-finger-tap is a individual tap using two fingers! This method has only one parameter, which is necessitate: full old element (it only works in the setting of anelement, not a point on the screen).

Example:

mobile: touchAndHold

Many iOS apps allow a user to trigger special behavior by tap and holding the finger down on a certain UI element. You can qualify all the same parameters as fordoubleTap (element, x, and y) with the like semantics. In increase you must set theduration parameter to specify how many seconds you desire the touch to be have.

// touch and hold an ingredient Mapargs = new HashMap < > (); args.put (`` constituent '', ((MobileElement) element) .getId ()); args.put (`` length '', 1.5); driver.executeScript (`` mobile: touchAndHold '', args);
mobile: dragFromToForDuration

Another commonly-implemented app motion is & quot; drag-and-drop & quot;. As with all of these motion, it & # x27; s possible to build a respectable drag-and-drop using the Actions API, but if for some reason this doesn & # x27; t employment, XCUITest has provided a method directly for this purpose. It & # x27; s amethod on the XCUICoordinate course, and in my opinion the name & # x27; dragFromToForDuration & # x27; isn & # x27; t the almost exact representation of it.

Really, what & # x27; s going on is that we & # x27; re defining a start and an end co-ordinate, and also the duration of thehold on the outset coordinate. In former words, we receive no control over the drag length itself, only on how long the initiatory coordinate is maintain before the drag happens. What parameters do we use?

  • element:an ingredient ID, which if provided will do Appium to treat the coordinates as comparative to this component. Absolute blind coordinates otherwise.
  • duration:the number of sec (between 0.5 and 6.0) that the start coordinates should be held
  • fromX:the x-coordinate of the start position
  • fromY: the y-coordinate of the offset position
  • toX:the x-coordinate of the end position
  • toY: the y-coordinate of the end place

Example:

// touch, clutches, and drag based on coordinates Mapargs = new HashMap < > (); args.put (`` duration '', 1.5); args.put (`` fromX '', 100); args.put (`` fromY '', 100); args.put (`` toX '', 300); args.put (`` toY '', 600); driver.executeScript (`` mobile: dragFromToForDuration '', args);

And with that our tour of the special iOS-specific gesture methods is complete! If you want to see a working example of some of the roll and swipe functionality, check outthis article & # x27; s code on GitHub, which makes use of a new scrolling list view added to The App!

Author & # x27; s Profile

Jonathan Lipps

LinkedIn
Author & # x27; s Profile

Piali Mazumdar

Lead, Content Marketing, HeadSpin Inc.

Piali is a dynamic and results-driven Content Marketing Specialist with 8+ years of experience in craft engaging story and market collateral across diverse industries. She surpass in collaborating with cross-functional squad to develop innovative substance strategy and render compelling, reliable, and impactful content that resonates with target audiences and enhances brand legitimacy.

LinkedIn

iOS-Specific Touch Action Methods

4 Parts

regression intelligence blog
-

Regression Intelligence hardheaded guidebook for forward-looking users (Part 3)

Coming Soon
Regression Intelligence practical guide for advanced users
-

Regression Intelligence virtual guide for advanced users (Part 4)

Coming Soon

Discover how HeadSpin can empower your business with superior testing capableness

Our Platform enable you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productivity with quicker development cycles
automated buil-over-build regression testing
Automate build-over-build regression quiz for ordered answer
gain better visibility into functional & performance issues
Gain better visibility into functional and performance subject
reduce mean time
Reduce average time to identify/resolve during tryout, QA, and product
evaluate audio, video & qoe
Evaluate audio, video, and content quality of experience (QoE) effortlessly
The trusted choice for globular enterprisingness
Adobe
Hargreaves Lansdown
Truecaller
Crazylabs
Nedbank
Numeracle
Veryon
Close

Discover how HeadSpin can empower your business with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a private-enterprise edge
faster development cycles
Boost developer/QA productiveness with quicker development rhythm
automated buil-over-build regression testing
Automate build-over-build regression testing for consistent results
gain better visibility into functional & performance issues
Gain better visibility into functional and performance topic
reduce mean time
Reduce mean time to identify/resolve during trial, QA, and production
evaluate audio, video & qoe
Evaluate sound, picture, and content quality of experience (QoE) effortlessly
The trusted choice for global enterprises
Close

Discover how HeadSpin can empower your business with superior testing capability

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productivity with faster evolution rhythm
automated buil-over-build regression testing
Automate build-over-build regression testing for coherent results
gain better visibility into functional & performance issues
Gain better visibility into functional and execution issue
reduce mean time
Reduce mean time to identify/resolve during test, QA, and production
evaluate audio, video & qoe
Evaluate audio, picture, and content quality of experience (QoE) effortlessly
The trusted choice for globose enterprises
Close

Connet Now

Wipro LogoVMLYR Logo
Close
Book a Meeting
Products
footer down arrow
Solutions
footer down arrow
Industries
footer down arrow
Features
footer down arrow
Support
footer down arrow
Resource Center
footer down arrow
Why Choose HeadSpin?
footer down arrow
Copyright © 2026 HeadSpin, Inc. All Rights Reserved.

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free