Using a Tap-By-Location Helper for Working With Unresponsive Elements

April 25, 2026 · 8 min read · Testing Guide

HeadSpin Platform
Automated & amp; manual testing made easy through data science insights.
Differentiating capableness:
  • Extensive end-to-end mechanisation of QA process
  • Relative analysis of app performance against peers
  • Uninterrupted monitoring of app performance using man-made data for higher availability of apps
  • Easy-to-use developer friendly program
cloudtest go
Affordable Existent Device Testing for Emerging Teams
cloudtest go
Low-cost Real Device Testing for Digital Enterprises
cloudtest go
The Ultimate Solution for a Powerful Blend of Functional & amp; Performance Testing!
cyol
TEM
New
Centralized mobile test execution in cloud
cyol
Enhance Your Accessibility Testing With HeadSpin
cyol
Automate camera-based examination

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

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

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

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

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

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

retail

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

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

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

Using a Tap-By-Location Helper for Working With Unresponsive ElementsUsing a Tap-By-Location Helper for Working With Unresponsive Elements

Using a Tap-By-Location Helper for Working With Unresponsive Elements

Published on
July 8, 2020
Updated on
Published on
January 24, 2022
Updated on
 by 
 Jonathan LippsJonathan Lipps
Jonathan Lipps

When I was work on a first-pass mechanization of a login stream for the Twitter Android app as portion of, I ran into an interesting problem, which is exemplify by the screenshot below.

Twitter Login Button

To get from the splash page to the login page, I needed to have Appium tap this & quot; Log in & quot; button. The only issue was, the button and the preceding text were all part of a individual element. I could find the ingredient, but when I used element.click () on it, nothing happened.

At first, I thought this was one of those lawsuit where the component is not appropriately responding to the behavior of the click command. In such cases, it & # x27; s ofttimes useful to make use of something I call a & quot; tap by localisation & quot; helper. This is a small assistant method that makes it easy to tap an element using theActions API, alternatively of finding an element acknowledgment and calling element.click () as you normally would. Here & # x27; s the basic approach:

  1. Find the element target
  2. Determine the position of the top-left corner of the element on the blind
  3. Determine the breadth and height of the element
  4. Use the answer of # 2 and # 3 to find the center of the element in price of screen-based X and Y coordinate
  5. Use the Actions API to generate a tap at those coordinates

Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script.

In code, it would look something like this, add to your base page object poser:

protected void tapAtPoint (Point point) {AppiumDriverd = getDriver (); // assuming hither a getDriver method PointerInput stimulus = new PointerInput (Kind.TOUCH, `` finger1 ''); Sequence tap = new Sequence (stimulation, 0); tap.addAction (input.createPointerMove (Duration.ZERO, Origin.viewport (), point.x, point.y)); tap.addAction (input.createPointerDown (MouseButton.LEFT.asArg ())); tap.addAction (new Pause (input, Duration.ofMillis (200))); tap.addAction (input.createPointerUp (MouseButton.LEFT.asArg ())); d.perform (ImmutableList.of (tap));} protected null tapElement (WebElement el) {Rectangle elRect = el.getRect (); Point point = new Point (elRect.x + (int) (elRect.getWidth () / 2.0), elRect.y + (int) (elRect.getHeight () / 2.0)); tapAtPoint (point);}

Basically, we create a generic tapAtPoint method which handles turning a Point object into an Actions tap at that point. Then, we create the actual helper, tapElement, which does all the math for finding the midpoint of an element. To accomplish this it make use of the getRect method for WebElements, since that method revert to us both the X and Y location of the top-left corner of the element, and the property. To happen the midpoint, we just divide the width and height by 2, and add those amount to the X and Y values for the top-left corner, severally.

Now, in our test codification, we can use the helper as follows (using an element from TheApp as an illustration):

WebElement el = driver.findElement (MobileBy.AccessibilityId (`` Login Screen '')); tapElement (el);

So I use this approach with the Twitter app, and thingsstilldidn & # x27; t work. What could be locomote on? Ultimately, I realized that it wasn & # x27; t enough to just tap the element containing the & # x27; Log in & # x27; text -- -I needed to tap that textbook specifically, still though it was all part of the like element as far as Appium was concerned. To make this possible, we would need to update our tapElement method, or more accurately, create a new helper method called tapElementAt. We take the ability to tap an component at an arbitrary distance from the top-left corner, and not just at the center. So here & # x27; s the set of helper methods we end up with when we make that addition and refactor:

protect void tapAtPoint (Point point) {AppiumDriverd = getDriver (); PointerInput input = new PointerInput (Kind.TOUCH, `` finger1 ''); Sequence tap = new Sequence (stimulation, 0); tap.addAction (input.createPointerMove (Duration.ZERO, Origin.viewport (), point.x, point.y)); tap.addAction (input.createPointerDown (MouseButton.LEFT.asArg ())); tap.addAction (new Pause (input, Duration.ofMillis (200))); tap.addAction (input.createPointerUp (MouseButton.LEFT.asArg ())); d.perform (ImmutableList.of (tap));} protect void tapElement (WebElement el) {tapElementAt (el, 0.5, 0.5);} protect null tapElementAt (WebElement el, double xPct, double yPct) {Rectangle elRect = el.getRect (); Point point = new Point (elRect.x + (int) (elRect.getWidth () * xPct), elRect.y + (int) (elRect.getHeight () * yPct)); tapAtPoint (point);}

Now, tapElement becomes just a special case of tapElementAt, with hard-coded values for the element-relative localisation to tap. Notice that we are utilize relative percent values to pass into tapElementAt, rather than pixels. This makes it easy for us to eyeball the element regardless of screen size, and enter values that make sense. For the Twitter app above, I ended up compose the eq of:

tapElementAt (el, 0.9, 0.5);

This yield a tap 90 % of the way from the left edge of the element (so only 10 % in from the correct edge), and 50 % downwards from the top (so right in the upright eye). And this did the trick! I recommend adding this kind of element tap helper to your framework for situations you see like this. And if you want to see these methods in action, psyche on over to theexample source codefor this edition.

Author & # x27; s Profile

Jonathan Lipps

LinkedIn
Author & # x27; s Profile

Piali Mazumdar

Lead, Content Marketing, HeadSpin Inc.

Piali is a dynamical and results-driven Content Marketing Specialist with 8+ days of experience in crafting pursue narratives and market collateral across diverse industry. She excels in collaborate with cross-functional teams to acquire innovative substance strategies and deliver compelling, reliable, and impactful content that vibrate with quarry hearing and enhances brand authenticity.

LinkedIn

Using a Tap-By-Location Helper for Working With Unresponsive Elements

4 Parts

regression intelligence blog
-

Regression Intelligence practical guide for advanced users (Part 3)

Coming Soon
Regression Intelligence practical guide for advanced users
-

Regression Intelligence practical guidebook for advanced users (Part 4)

Coming Soon

Discover how HeadSpin can authorize your line with superior testing capabilities

Our Platform enables you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productiveness with faster development cycles
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 issues
reduce mean time
Reduce hateful time to identify/resolve during test, QA, and product
evaluate audio, video & qoe
Evaluate audio, video, and content quality of experience (QoE) effortlessly
The sure selection for global endeavour
Adobe
Hargreaves Lansdown
Truecaller
Crazylabs
Nedbank
Numeracle
Veryon
Close

Discover how HeadSpin can empower your job with superior testing capabilities

Our Platform enable you to:
accelerate time-to-market
Accelerate time-to-market, gaining a competitive edge
faster development cycles
Boost developer/QA productiveness with faster development cycles
automated buil-over-build regression testing
Automate build-over-build fixation examine for logical solution
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 test, QA, and production
evaluate audio, video & qoe
Evaluate audio, video, and content quality of experience (QoE) effortlessly
The trusted choice for world enterprisingness
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, acquire a militant edge
faster development cycles
Boost developer/QA productivity with faster development cycles
automated buil-over-build regression testing
Automate build-over-build fixation testing for consistent resultant
gain better visibility into functional & performance issues
Gain better visibility into functional and performance issues
reduce mean time
Reduce mean clip to identify/resolve during test, QA, and production
evaluate audio, video & qoe
Evaluate sound, picture, and content quality of experience (QoE) effortlessly
The trusted choice for worldwide 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