முக்கிய உள்ளடக்கத்திற்கு தாவு

சுவைப்

Swipe in a specific direction within viewport or element for Desktop/Mobile Web AND Mobile Native Apps.

தகவல்

Swiping for Mobile Native Apps is based on the W3C-actions protocol, simulating a finger press and movement. This is different from the mobile: scrollGesture for Android or mobile: scroll for iOS command which is based on the Appium Driver protocol and is only available for mobile platforms in the NATIVE context.

This command only works with the following up-to-date components:

  • Appium server (version 2.0.0 or higher)
  • appium-uiautomator2-driver (for Android)
  • appium-xcuitest-driver (for iOS)

Make sure your local or cloud-based Appium environment is regularly updated to avoid compatibility issues.

Swiping based on coordinates

Avoid using from and to options unless absolutely necessary. These are device-specific and may not work consistently across devices. Use the scrollableElement option for reliable swipes within an element.

Parameters
NameTypeDetails
options
optional
object, booleanoptions for browser.swipe(). Default for desktop/mobile web:
{ direction: 'up', duration: 1500, percent: 0.95, scrollableElement: WebdriverIO.Element }
options.direction
optional
stringCan be one of down, up, left or right, default is up.
MOBILE-NATIVE-APP-ONLY
Down
தொடக்க புள்ளி:
திரையின் மேல் பகுதியில் உங்கள் விரலை வைக்கிறீர்கள்.
இயக்கம்:
திரையின் கீழ் பகுதி நோக்கி உங்கள் விரலை கீழே நகர்த்துகிறீர்கள்.
செயல்:
இது சூழலைப் பொறுத்து மாறுபடுகிறது:
- முகப்புத் திரையில் அல்லது பயன்பாடுகளில், இது பொதுவாக உள்ளடக்கத்தை மேலே உருட்டுகிறது.
- மேல் விளிம்பிலிருந்து, இது பெரும்பாலும் அறிவிப்பு பலகம் அல்லது விரைவு அமைப்புகளைத் திறக்கிறது.
- உலாவிகள் அல்லது படிக்கும் பயன்பாடுகளில், உள்ளடக்கத்தை உருட்டப் பயன்படுத்தலாம்.
Left
தொடக்க புள்ளி:
திரையின் வலது பக்கத்தில் உங்கள் விரலை வைக்கிறீர்கள்.
இயக்கம்:
உங்கள் விரலை கிடைமட்டமாக இடதுபுறமாக நகர்த்துகிறீர்கள்.>
செயல்:
இந்த சைகைக்கான பதில் பயன்பாட்டைப் பொறுத்து அமையும்:
- இது கருசெல் அல்லது படங்களின் தொகுப்பில் அடுத்த உருப்படிக்கு நகரலாம்.
- வழிசெலுத்தல் சூழலில், இது முந்தைய பக்கத்திற்குத் திரும்பச் செல்லலாம் அல்லது தற்போதைய காட்சியை மூடலாம்.
- முகப்புத் திரையில், இது பொதுவாக அடுத்த மெய்நிகர் டெஸ்க்டாப் அல்லது திரைக்கு மாறும்.
Right
தொடக்க புள்ளி:
திரையின் இடது பக்கத்தில் உங்கள் விரலை வைக்கிறீர்கள்.
இயக்கம்:
உங்கள் விரலை கிடைமட்டமாக வலதுபுறமாக நகர்த்துகிறீர்கள்.
செயல்:
இடதுபுறமாக சுவைப் செய்வதைப் போலவே, ஆனால் எதிர் திசையில்:
-- இது பெரும்பாலும் கருசெல் அல்லது தொகுப்பில் முந்தைய உருப்படிக்கு நகரும்.
- பயன்பாடுகளில் பக்க மெனுக்கள் அல்லது வழிசெலுத்தல் இழுப்பதை திறக்கப் பயன்படுத்தலாம்.
- முகப்புத் திரையில், இது பொதுவாக முந்தைய மெய்நிகர் டெஸ்க்டாப்பிற்கு மாறும்.
Up
தொடக்க புள்ளி:
திரையின் கீழ் பகுதியில் உங்கள் விரலை வைக்கிறீர்கள்.
இயக்கம்:
திரையின் மேல் பகுதி நோக்கி உங்கள் விரலை மேலே நகர்த்துகிறீர்கள்.>
செயல்:
சூழலைப் பொறுத்து, வெவ்வேறு செயல்கள் நிகழலாம்:
- முகப்புத் திரையில் அல்லது பட்டியலில், இது பொதுவாக உள்ளடக்கத்தை கீழ்நோக்கி உருட்டுகிறது.
- முழுத்திரை பயன்பாட்டில், இது கூடுதல் விருப்பங்களையோ அல்லது பயன்பாட்டு இழுப்பையோ திறக்கலாம்.
- குறிப்பிட்ட இடைமுகங்களில், இது 'புதுப்பிப்பு' செயலைத் தூண்டலாம் அல்லது தேடல் பட்டியைத் திறக்கலாம்.
options.duration
optional
numberThe duration in milliseconds for the swipe. Default is 1500 ms. The lower the value, the faster the swipe.
options.scrollableElement
optional
ElementElement that is used to swipe within. If no element is provided it will use the following selector for iOS -ios predicate string:type == "XCUIElementTypeApplication" and the following for Android //android.widget.ScrollView'. If more elements match the default selector, then by default it will pick the first matching element.
MOBILE-NATIVE-APP-ONLY
options.percent
optional
numberThe percentage of the (default) scrollable element to swipe. This is a value between 0 and 1. Default is 0.95.
NEVER swipe from the exact top|bottom|left|right of the screen, you might trigger for example the notification bar or other OS/App features which can lead to unexpected results.
This has no effect if from and to are provided.
The below values ONLY have an effect if the scrollableElement is NOT provided, otherwise they are ignored.
options.from
optional
objectThe x and y coordinates of the start of the swipe. If a scrollableElement is provided, then these coordinates have no effect.
options.from.x
optional
numberThe x-coordinate of the start of the swipe.
options.from.y
optional
numberThe y-coordinate of the start of the swipe.
options.to
optional
objectThe x and y coordinates of the end of the swipe. If a scrollableElement is provided, then these coordinates have no effect.
options.to.x
optional
numberThe x-coordinate of the end of the swipe.
options.to.y
optional
numberThe y-coordinate of the end of the swipe.
Examples
swipe.js
it('should execute a default swipe', async () => {
// Default will be a swipe from the bottom to the top, meaning it will swipe UP
await browser.swipe();
});

swipe.with.options.js
it('should execute a swipe with options', async () => {
await browser.swipe({
direction: 'left', // Swipe from right to left
duration: 5000, // Last for 5 seconds
percent: 0.5, // Swipe 50% of the scrollableElement
scrollableElement: $('~carousel'), // The element to swipe within
})
});

Welcome! How can I help?

WebdriverIO AI Copilot