webdriverio
Advanced tools
Comparing version 9.2.12 to 9.2.14
@@ -0,8 +1,17 @@ | ||
import type { CustomScrollIntoViewOptions } from '../../types.js'; | ||
/** | ||
* | ||
* Scroll element into viewport ([MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView)). | ||
* Scroll element into viewport for Desktop/Mobile Web <strong>AND</strong> Mobile Native Apps. | ||
* | ||
* :::info | ||
* | ||
* Scrolling for Mobile Native Apps is done based on native mobile gestures. It is only supported for the following drivers: | ||
* - [appium-uiautomator2-driver](https://github.com/appium/appium-uiautomator2-driver/blob/master/docs/android-mobile-gestures.md#mobile-scrollgesture) for Android | ||
* - [appium-xcuitest-driver](https://appium.github.io/appium-xcuitest-driver/latest/reference/execute-methods/#mobile-scroll) for iOS | ||
* | ||
* ::: | ||
* | ||
* <example> | ||
:scrollIntoView.js | ||
it('should demonstrate the scrollIntoView command', async () => { | ||
:desktop.mobile.web.scrollIntoView.js | ||
it('should demonstrate the desktop/mobile web scrollIntoView command', async () => { | ||
const elem = await $('#myElement'); | ||
@@ -16,4 +25,21 @@ // scroll to specific element | ||
* | ||
* <example> | ||
: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') }); | ||
}); | ||
* </example> | ||
* | ||
* @alias element.scrollIntoView | ||
* @param {object|boolean=} scrollIntoViewOptions options for `Element.scrollIntoView()` (default: `{ block: 'start', inline: 'nearest' }`) | ||
* @param {object|boolean=} options options for `Element.scrollIntoView()`. Default for desktop/mobile web: <br/> `{ block: 'start', inline: 'nearest' }` <br /> Default for Mobile Native App <br /> `{ maxScrolls: 10, scrollDirection: 'down' }` | ||
* @param {string=} options.behavior See [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView). <br /><strong>WEB-ONLY</strong> (Desktop/Mobile) | ||
* @param {string=} options.block See [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView). <br /><strong>WEB-ONLY</strong> (Desktop/Mobile) | ||
* @param {string=} options.inline See [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView). <br /><strong>WEB-ONLY</strong> (Desktop/Mobile) | ||
* @param {string=} options.direction Can be one of `down`, `up`, `left` or `right`, default is `down`. <br /><strong>MOBILE-NATIVE-APP-ONLY</strong> | ||
* @param {number=} options.maxScrolls The max amount of scrolls until it will stop searching for the element, default is `10`. <br /><strong>MOBILE-NATIVE-APP-ONLY</strong> | ||
* @param {Element=} options.scrollableElement 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. <br /> <strong>MOBILE-NATIVE-APP-ONLY</strong> | ||
* @uses protocol/execute | ||
@@ -23,3 +49,3 @@ * @type utility | ||
*/ | ||
export declare function scrollIntoView(this: WebdriverIO.Element, options?: ScrollIntoViewOptions | boolean): Promise<void>; | ||
export declare function scrollIntoView(this: WebdriverIO.Element, options?: CustomScrollIntoViewOptions | boolean): Promise<void | unknown>; | ||
//# sourceMappingURL=scrollIntoView.d.ts.map |
@@ -29,3 +29,3 @@ /** | ||
*/ | ||
export declare function shadow$$(this: WebdriverIO.Element, selector: string): Promise<import("../../types.js").ChainablePromiseArray | WebdriverIO.ElementArray>; | ||
export declare function shadow$$(this: WebdriverIO.Element, selector: string): Promise<WebdriverIO.ElementArray | import("../../types.js").ChainablePromiseArray>; | ||
//# sourceMappingURL=shadow$$.d.ts.map |
@@ -430,2 +430,15 @@ import type { EventEmitter } from 'node:events'; | ||
}; | ||
export declare enum MobileScrollDirection { | ||
Down = "down", | ||
Up = "up", | ||
Left = "left", | ||
Right = "right" | ||
} | ||
export type MobileScrollIntoViewOptions = { | ||
direction?: MobileScrollDirection; | ||
maxScrolls?: number; | ||
scrollableElement?: WebdriverIO.Element; | ||
}; | ||
export interface CustomScrollIntoViewOptions extends ScrollIntoViewOptions, MobileScrollIntoViewOptions { | ||
} | ||
export type WaitUntilOptions = { | ||
@@ -432,0 +445,0 @@ timeout?: number; |
{ | ||
"name": "webdriverio", | ||
"description": "Next-gen browser and mobile automation test framework for Node.js", | ||
"version": "9.2.12", | ||
"version": "9.2.14", | ||
"homepage": "https://webdriver.io", | ||
@@ -113,3 +113,3 @@ "author": "Christian Bromann <mail@bromann.dev>", | ||
}, | ||
"gitHead": "5283e03d12615050ba8e1c54a9903e171068d143" | ||
"gitHead": "6ba40850cc38dbb9a9622bee11939a19fb45bead" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
731049
17211