Autosana Logo
    Autosana
    • SandboxesBeta
    • Enterprise
    • Pricing
    Contact salesTry for free
    Resources

    Blog

    Insights on automated testing and QA best practices.

    BlogProduct updatesCase studies
    AllComparisonsBest ToolsMobile TestingAI TestingTesting Fundamentals

    Fix bugs, not tests.

    Talk to an expert.

    Book 30 minutes with our team. We'll show you Autosana running on your app.

    Contact sales

    Start building.

    Describe a user journey and watch an agent run it on iOS, Android, and web.

    Try for free
    Autosana

    Catch bugs before your users do.

    Try for free

    Product

    • Platform
    • Use cases
    • Enterprise
    • Pricing

    Resources

    • Docs
    • Case Studies
    • Product Updates
    • Blog

    Company

    • Contact sales
    • Careers
    • LinkedIn

    Trust

    • Status
    • Security
    • SOC 2 Type 1 · Type 2 in review
    • Backed by

    © 2026 Autosana. All rights reserved.

    Autosana Logo
    Autosana
    • SandboxesBeta
    • Enterprise
    • Pricing
    Contact salesTry for free
    Written by
    Read time
    Published
    Autosana

    Catch bugs before your users do.

    Try for free

    Product

    • Platform
    • Use cases
    • Enterprise
    • Pricing

    Resources

    • Docs
    • Case Studies
    • Product Updates
    • Blog

    Company

    • Contact sales
    • Careers
    • LinkedIn

    Trust

    • Status
    • Security
    • SOC 2 Type 1 · Type 2 in review
    • Backed by

    © 2026 Autosana. All rights reserved.

    Autosana Logo
    Autosana
    • SandboxesBeta
    • Enterprise
    • Pricing
    Contact salesTry for free
    Back to Blog
    Blog

    iOS points vs pixels: why coordinate taps miss in automation

    iOS points vs pixels, Android dp to px and adb shell input tap coordinates: the conversions, frames and settle checks that make screenshot-driven taps land.

    Written by
    Yuvan Sundrani
    Read time
    9 min read
    Published
    December 1, 2026
    iOS points vs pixels: why coordinate taps miss in automation

    Key Takeaways

    • UIKit measures in points; a screenshot is pixels. Divide by UIScreen.scale (2.0 or 3.0 on Retina) before handing a screenshot coordinate to a points-based driver.
    • Android view coordinates are pixels, and px = dp * (dpi / 160), so a 48 dp button is 126 px wide at 420 dpi.
    • A pipeline that resizes screenshots before a model sees them gets coordinates in the resized image, which must be scaled back first.
    • UIScreen.nativeBounds is portrait-up and doesn't rotate, so landscape coordinates need an axis swap.
    • A tap computed from a frame captured mid-animation lands where the element was; settle the screen, then capture again.

    A coordinate tap lands only if it is replayed in the same unit, the same frame and the same screen state it was measured in.

    iOS points vs pixels vs Android dp

    Apple's UIScreen.scale reference defines the logical coordinate space as points, with a scale factor of 3.0 or 2.0 on Retina displays, where one point is nine or four pixels. UIScreen.bounds is measured in points and nativeBounds in pixels.

    Android's screen density guide defines dp as a virtual pixel roughly equal to one physical pixel at 160 dpi and gives the conversion as px = dp * (dpi / 160). AOSP's View Javadoc states that view locations and dimensions are in pixels.

    Worked example, one tap target on each platform:


    iOS, scale 3.0Android, 420 dpi
     
    Logical size44 × 44 pt48 × 48 dp
    Pixels132 × 132 px126 × 126 px
    Center, logical(38, 800) pt(196, 800) dp
    Center, pixels(114, 2400) px(514.5, 2100) px
    Screen width393 pt = 1179 px411.4 dp = 1080 px

    The figures are an example for a scale-3 iPhone and a 1080-pixel-wide, 420 dpi Android device. The conversions in both directions:

    iOS       pt = px / UIScreen.scale          px = pt * UIScreen.scale
    Android   px = dp * (dpi / 160)             dp = px * 160 / dpi

    Android's guide adds that app code should call TypedValue.applyDimension() instead of hardcoding the formula. Test tooling outside the app reads the density from the device:

    adb shell wm size       # Physical size: 1080x2400
    adb shell wm density    # Physical density: 420

    If either command also prints an Override size or Override density line, someone has changed the display with wm. Verify which grid screenshots and taps use on that device before trusting any conversion: turn on Developer options > Pointer location and tap a known corner.

    One point and one dp drawn as pixel grids: at scale 2.0 one iOS point is 4 pixels, at scale 3.0 it is 9 pixels, and at 420 dpi one Android dp is 2.625 pixels on a side, so a 44 point button is 88 or 132 pixels and a 48 dp button is 126 pixels
    Taps that land where users tap. Try Autosana for free.

    Tap coordinate units by automation tool

    ToolCoordinate it takesSource of truth
     
    XCUITest coordinate(withNormalizedOffset:)A screen point: element origin plus offset times element sizeApple XCUIElement reference
    Appium XCUITest driverOffsets; mobile: deviceScreenInfo returns scale and statusBarSizeappium-xcuitest-driver execute methods
    adb shell input tap <x> <y>Values passed to MotionEvent X and Y; the help text names no unitAOSP InputShellCommand.java
    Maestro tapOn: point:Percentages ("50%,50%") or absolute pixel values ("100,200")Maestro tapOn reference
    Autosana sandbox tapPixels in the latest screenshotAutosana sandbox docs

    Moving a coordinate from one row to another needs a conversion. Maestro's percentages survive a density change and break on a layout change. Maestro's own reference recommends selectors over coordinates for that reason.

    Screenshot coordinates in vision-model agents

    Agent pipelines add a fourth coordinate space: the image the model actually received. Many pipelines downscale screenshots to cut tokens, and the model answers in the downscaled image.

    # Example. Screenshot from `xcrun simctl io booted screenshot`; confirm its size
    # matches UIScreen.nativeBounds for the device before relying on it.
    shot_w, shot_h = 1179, 2556      # screenshot pixels
    sent_w = 768                     # width of the image the model received
    scale = 3.0                      # UIScreen.scale, or mobile: deviceScreenInfo
    mx, my = 59, 799                 # model's answer, in the 768-wide image

    # Bug: treating (59, 799) as points taps 390 pt below the target.

    k = shot_w / sent_w              # 1.535; resize was uniform, so one factor
    px, py = mx * k, my * k          # (90.6, 1226.6) screenshot pixels
    pt = (px / scale, py / scale)    # (30.2, 408.9) points for a points-based driver

    Two conversions, in order: resized image to screenshot pixels, then pixels to the driver's unit. Skipping the first produces taps that are off by the resize factor; skipping the second produces taps off by the screen scale, usually past the bottom edge on a scale-3 device.

    Tap coordinates after screen rotation

    Rotation. Apple documents nativeBounds as based on a portrait-up device and unchanged by rotation. A converter built from nativeBounds has to swap axes in landscape. For a landscape screenshot W pixels wide, a point (x, y) maps to portrait-up (y, W - x) or (H - y, x), depending on which way the device turned.

    Test both orientations; a converter that is right in one is wrong in the other.

    Insets on iOS. safeAreaInsets apply to a view's bounds in points. A coordinate measured relative to the safe area needs the inset added before it becomes a screen coordinate.

    Edge-to-edge on Android 15. Android's behavior-change notes say apps targeting API level 35 are edge-to-edge by default on Android 15 devices. Content that started below the status bar now starts at y = 0 unless the app handles insets. Coordinates recorded against a build targeting 34 shift by the status bar height the day targetSdk moves to 35.

    Why do taps miss after an animation?

    A screenshot taken during a transition records where an element was. The tap then lands on the element's old position, which after the animation is empty space or a different control.

    Three frames of the same screen: at t0 the screenshot catches the Continue button mid-slide and the tap target is computed there; at t1 the button has settled lower and the stale tap lands on empty space; at t2 a fresh screenshot after settling puts the tap on the button

    The Espresso setup guide recommends turning off three settings on test devices to avoid flakiness: Window animation scale, Transition animation scale and Animator duration scale. That removes system animations; it does nothing for in-app spinners, list loads or a keyboard sliding up. For those, wait until consecutive frames match:

    import hashlib, subprocess, time

    def frame_hash():
        png = subprocess.run(["adb", "exec-out", "screencap", "-p"],
                            capture_output=True, check=True).stdout
        return hashlib.sha256(png).hexdigest()

    def settle(interval=0.25, stable=2, timeout=5.0):
        last, same, deadline = frame_hash(), 0, time.time() + timeout
        while time.time() < deadline:
            time.sleep(interval)
            cur = frame_hash()
            same = same + 1 if cur == last else 0
            if same >= stable:
                return True
            last = cur
        return False

    Exact hash equality never settles on a screen with a blinking text cursor, and a status-bar clock can tick between frames. Crop the status bar and the focused field, or compare with a small pixel tolerance. Capture the screenshot used for the tap after settle() returns, never before.

    Autosana for screenshot-driven taps

    Autosana is an AI end-to-end testing agent for iOS, Android and web apps. Our agent works from screenshots, and our Autosana sandboxes keep the image and the tap in the same coordinate space, so the conversions above stop being your code's job.

    Autosana key features for coordinate input

    1. Taps in the screenshot's own pixels. autosana sandbox tap 603,1311 takes pixels in the latest screenshot, the same image the agent looked at. There's no step that converts the image's coordinates into the device's input space.
    2. A settled screenshot after every action. Each action waits for the screen to settle, then saves a new screenshot, so the next coordinate is always computed against the current screen. autosana sandbox wait 2s adds an explicit pause, and every command takes --json for scripts.
    3. Tests with no coordinates in them. Our tests are written as instructions, for example "Add the first search result to the cart and check that the cart badge shows 1." The agent finds the control on the current screen when the test runs, so a layout change doesn't break a stored position. The Autosana flow writing guide covers the style, and how computer use agents test mobile apps covers how the agent resolves a target.
    Agent actions listing each tap with its timing next to the iOS screen the agent was reading
    Each tap is recorded as a described step ("tap the Light chip") with its time, next to the screen the agent read before tapping. Source: Autosana GitHub Bot docs video.

    Each tap is recorded as a described step ("tap the Light chip") with its time, next to the screen the agent read before tapping. Source: Autosana GitHub Bot docs video.

    Autosana customer results

    • Gobi (social maps app) replaced 13 brittle Maestro tests with 30+ Autosana tests. Their CTO: "It's like a human is using your app." See the Gobi case study.

    Where Autosana fits less well

    • Sandbox taps use screenshot pixels on every platform, so a script that mixes them with XCUITest point coordinates still divides by the scale factor.
    • Games drawn into a single engine canvas are a poor fit for screenshot-driven steps.
    • We don't run existing Espresso or XCTest bundles.

    Why use Autosana for screenshot-driven taps?

    • No unit conversion between image and input. The tap uses the same pixels the agent saw.
    • Stale frames stop being a source of misses. Each action captures a fresh, settled screenshot before the next decision.
    • Tests survive layout changes. Instructions name what the user does, and the agent locates the control on each run.
    • Both orientations in one session. autosana sandbox set orientation landscape switches mid-run.
    • Start without a card. Up to 1,000 AI actions a month are free on pay as you go.
    Tests that survive layout changes. Try Autosana for free.

    Conclusion

    Selectors stay the first choice where they exist; the Jetpack Compose resource ID problem shows how often they don't. Canvases, games, system dialogs and vision-model agents all fall back to coordinates.

    For those, a tap is reliable when it's converted to the receiving tool's unit, mapped into the current orientation and inset frame, and computed from a screenshot taken after the screen settled. Get one of the three wrong and the failure looks like flakiness.

    Why most suites fail at waiting covers the timing half in more depth.

    Self-healing mobile tests covers what happens when the target itself moves.

    FAQs

    1. How do iOS points relate to pixels?

    Pixels equal points times UIScreen.scale: 2.0 or 3.0 on Retina, 1.0 on standard displays.

    2. What is the formula for Android dp to px?

    px = dp * (dpi / 160). At 420 dpi, one dp is 2.625 pixels.

    3. What unit does adb shell input tap use?

    AOSP's help text names no unit. Confirm with Developer options > Pointer location.

    4. Why does my tap hit the wrong element after an animation?

    The screenshot caught a moving element. Wait for identical consecutive frames, then capture again.

    5. What coordinates does Maestro tapOn point accept?

    Both. tapOn accepts percentages like "50%,50%" or absolute pixel values.

    6. What coordinates do Autosana sandbox taps take?

    Pixels in the latest screenshot, which each action captures after the screen settles.

    Sources

    • Apple Developer: UIScreen.scale
    • Android Developers: Support different pixel densities

    ‍

    Fix bugs, not tests.

    Talk to an expert.

    Book 30 minutes with our team. We'll show you Autosana running on your app.

    Contact sales

    Start building.

    Describe a user journey and watch an agent run it on iOS, Android, and web.

    Try for free
    Autosana

    Catch bugs before your users do.

    Try for free

    Product

    • Platform
    • Use cases
    • Enterprise
    • Pricing

    Resources

    • Docs
    • Case Studies
    • Product Updates
    • Blog

    Company

    • Contact sales
    • Careers
    • LinkedIn

    Trust

    • Status
    • Security
    • SOC 2 Type 1 · Type 2 in review
    • Backed by

    © 2026 Autosana. All rights reserved.