#98. "ADB Concepts-10" - How to Simulate a swipe (or drag) gesture on a Android device Using "ADB Commands"
Command — adb shell input swipe <x1> <y1> <x2> <y2> [duration(ms)]
Swipe’ Command:
The adb shell input swipe command is used to simulate a swipe (or drag) gesture on an Android device from your computer via ADB (Android Debug Bridge). It is part of the adb shell input command suite, which allows you to simulate user input like taps, swipes, key events, etc.
Basic Syntax:
adb shell input swipe <x1> <y1> <x2> <y2> [duration(ms)]
Explanation:
adb: Android Debug Bridge tool
shell: Executes a shell command on the device
input: Command to simulate user input
swipe: Simulates a finger swipe on the screen
<x1>: Horizontal screen coordinate (in pixels)
<y1>: Vertical screen coordinate (in pixels)
<x2>: Horizontal screen coordinate (in pixels)
<y2>: Vertical screen coordinate (in pixels)
duration(ms): Swipe duration in milliseconds(Optional)
Example Usage:
Perform Swipe Without duration:
adb shell input swipe 560 1800 560 490
Example:
Recommended by LinkedIn
Perform Swipe With duration(millseconds):
adb shell input swipe 560 1800 560 490 1000
This simulates a swipe at the coordinates (560, 1800, 560, 490) with duration 10 seconds on the device screen.
Example:
Use Cases:
1.Automating UI testing
2.Bypassing parts of an app manually (e.g., skip splash screens)
3.Scripting user behavior for demos or data entry
Notes:
Coordinates depend on screen resolution and orientation. Make sure USB debugging is enabled on your Android device. You can find coordinates using screenshot tools or apps that display touch location.
Get a step-by-step walkthrough in the video below!
🚀 Enhance Your Automation Skills with My Content!
📺 YouTube – AppiumGuide Explore in-depth tutorials and hands-on guides on mobile automation testing. 🔗 Watch Now
✍️ Medium – Articles & Insights Stay updated with expert-written articles on Appium, Selenium, and test automation strategies. 🔗 Read Here
💻 GitHub – Open-Source Contributions Access automation frameworks, sample projects, and best practices in mobile testing. 🔗 Explore Code
👍 𝗟𝗶𝗸𝗲 if you found it helpful!🔁 𝗥𝗲𝗽𝗼𝘀𝘁 with your network!🔖 𝗦𝗮𝘃𝗲 for future use!📤 𝗦𝗲𝗻𝗱 to your connections!💬 𝗖𝗼𝗺𝗺𝗲𝗻𝘁 your thoughts below!