scrollIntoView
டெஸ்க்டாப்/மொபைல் வெப் மற்றும் மொபைல் நேட்டிவ் ஆப்ஸ்க்கான எலிமென்ட்டை பார்க்கும் திரைக்கு ஸ்க்ரோல் செய்யும்.
தகவல்
மொபைல் நேட்டிவ் ஆப்ஸில் ஸ்க்ரோலிங் மொபைல் swipe
கமாண்டை அடிப்படையாகக் கொண்டு செய்யப்படுகிறது.
இந்த கமாண்ட் பின்வரும் புதுப்பிக்கப்பட்ட கூறுகளுடன் மட்டுமே வேலை செய்யும்:
- Appium சர்வர் (பதிப்பு 2.0.0 அல்லது அதற்கு மேல்)
appium-uiautomator2-driver
(ஆண்ட்ராய்டுக்கு)appium-xcuitest-driver
(iOS க்கு)
இணக்கப்பாட்டு சிக்கல்களைத் தவிர்க்க உங்கள் உள்ளூர் அல்லது கிளவுட் அடிப்படையிலான Appium சூழலை தொட ர்ந்து புதுப்பித்து வைத்திருப்பதை உறுதி செய்யவும்.
அளவுருக்கள்
பெயர் | வகை | விவரங்கள் |
---|---|---|
options optional | object, boolean | options for Element.scrollIntoView() . Default for desktop/mobile web: { block: 'start', inline: 'nearest' } Default for Mobile Native App { maxScrolls: 10, scrollDirection: 'down' } |
டெஸ்க்டாப்/மொபைல் வெப் மட்டும் | ||
options.behavior optional | string | See MDN Reference. வெப்-மட்டும் (டெஸ்க்டாப்/மொபைல்) |
options.block optional | string | See MDN Reference. வெப்-மட்டும் (டெஸ்க்டாப்/மொபைல்) |
options.inline optional | string | See MDN Reference. வெப்-மட்டும் (டெஸ்க்டாப்/மொபைல்) |
மொபைல் நேட்டிவ் ஆப் மட்டும் | ||
options.direction optional | string | Can be one of down , up , left or right , default is up . மொபைல்-நேட்டிவ்-ஆப்-மட்டும் |
options.maxScrolls optional | number | The max amount of scrolls until it will stop searching for the element, default is 10 . மொபைல்-நேட்டிவ்-ஆப்-மட்டும் |
options.duration optional | number | The duration in milliseconds for the swipe. Default is 1500 ms. The lower the value, the faster the swipe.மொபைல்-நேட்டிவ்-ஆப்-மட்டும் |
options.scrollableElement optional | Element | Element that is used to scroll 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. மொபைல்-நேட்டிவ்-ஆப்-மட்டும் |
options.percent optional | number | The percentage of the (default) scrollable element to swipe. This is a value between 0 and 1. Default is 0.95 .எப்போதும் திரையின் மேல்|கீழ்|இடது|வலது முனையிலிருந்து ஸ்வைப் செய்யாதீர்கள், இது அறிவிப்பு பட்டியல் அல்லது பிற OS/ஆப் அம்சங்களைத் தூண்டலாம், இது எதிர்பாராத முடிவுகளுக்கு வழிவகுக்கும். மொபைல்-நேட்டிவ்-ஆப்-மட்டும் |
எடுத்துக்காட்டுகள்
desktop.mobile.web.scrollIntoView.js
it('should demonstrate the desktop/mobile web scrollIntoView command', async () => {
const elem = await $('#myElement');
// scroll to specific element
await elem.scrollIntoView();
// center element within the viewport
await elem.scrollIntoView({ block: 'center', inline: 'center' });
});
mobile.native.app.scrollIntoView.js
it('should demonstrate the mobile native app scrollIntoView command', async () => {
const elem = await $('#myElement');
// scroll to a specific element in the default scrollable element for Android or iOS for a maximum of 10 scrolls
await elem.scrollIntoView();
// Scroll to the left in the scrollable element called '#scrollable' for a maximum of 5 scrolls
await elem.scrollIntoView({
direction: 'left',
maxScrolls: 5,
scrollableElement: $('#scrollable')
});
});