webdriverio
- Version 8.36.0
- Published
- 612 kB
- 24 dependencies
- MIT license
Install
npm i webdriverio
yarn add webdriverio
pnpm add webdriverio
Overview
Next-gen browser and mobile automation test framework for Node.js
Index
Variables
Functions
Interfaces
Type Aliases
- ActionTypes
- AddCommandFn
- BrowserCommandsType
- ClickOptions
- CustomLocatorReturnValue
- CustomStrategyFunction
- CustomStrategyReference
- DragAndDropCoordinate
- DragAndDropOptions
- ElementArray
- ElementCommandsType
- ElementFunction
- ErrorCode
- Matcher
- MixedContentType
- MockFilterOptions
- MockOverwrite
- MockOverwriteFunction
- MockResponseParams
- MoveToOptions
- MultiRemoteBrowserCommandsType
- MultiRemoteElementCommandsType
- MultiRemoteProtocolCommandsType
- NewWindowOptions
- ReactSelectorOptions
- ReferrerPolicy
- RemoteOptions
- ResourcePriority
- Selector
- ThrottleOptions
- ThrottlePreset
- TouchActionParameter
- TouchActions
- WaitForOptions
- WaitUntilOptions
Variables
variable Key
const Key: { readonly Ctrl: 'WDIO_CONTROL'; readonly NULL: ''; readonly Cancel: ''; readonly Help: ''; readonly Backspace: ''; readonly Tab: ''; readonly Clear: ''; readonly Return: ''; readonly Enter: ''; readonly Shift: ''; readonly Control: ''; readonly Alt: ''; readonly Pause: ''; readonly Escape: ''; readonly Space: ''; readonly PageUp: ''; readonly PageDown: ''; readonly End: ''; readonly Home: ''; readonly ArrowLeft: ''; readonly ArrowUp: ''; readonly ArrowRight: ''; readonly ArrowDown: ''; readonly Insert: ''; readonly Delete: ''; readonly Semicolon: ''; readonly Equals: ''; readonly Numpad0: ''; readonly Numpad1: ''; readonly Numpad2: ''; readonly Numpad3: ''; readonly Numpad4: ''; readonly Numpad5: ''; readonly Numpad6: ''; readonly Numpad7: ''; readonly Numpad8: ''; readonly Numpad9: ''; readonly Multiply: ''; readonly Add: ''; readonly Separator: ''; readonly Subtract: ''; readonly Decimal: ''; readonly Divide: ''; readonly F1: ''; readonly F2: ''; readonly F3: ''; readonly F4: ''; readonly F5: ''; readonly F6: ''; readonly F7: ''; readonly F8: ''; readonly F9: ''; readonly F10: ''; readonly F11: ''; readonly F12: ''; readonly Command: ''; readonly ZenkakuHankaku: '';};
variable SevereServiceError
const SevereServiceError: typeof SevereServiceErrorImport;
Functions
function attach
attach: (attachOptions: AttachOptions) => Promise<WebdriverIO.Browser>;
function multiremote
multiremote: ( params: Capabilities.MultiRemoteCapabilities, { automationProtocol }?: { automationProtocol?: string }) => Promise<WebdriverIO.MultiRemoteBrowser>;
WebdriverIO allows you to run multiple automated sessions in a single test. This is handy when you're testing features that require multiple users (for example, chat or WebRTC applications).
Instead of creating a couple of remote instances where you need to execute common commands like newSession() or url() on each instance, you can simply create a multiremote instance and control all browsers at the same time.
NOTE: Multiremote is not meant to execute all your tests in parallel. It is intended to help coordinate multiple browsers and/or mobile devices for special integration tests (e.g. chat applications).
Parameter params
capabilities to choose desired devices.
Parameter automationProtocol
All remote instances, the first result represents the capability defined first in the capability object, the second result the second capability and so on.
See Also
External document and example usage.
function remote
remote: ( params: RemoteOptions, remoteModifier?: ( client: WebDriverTypes.Client, options: Options.WebdriverIO ) => WebDriverTypes.Client) => Promise<WebdriverIO.Browser>;
A method to create a new session with WebdriverIO.
NOTE: If you hit "error TS2694: Namespace 'global.WebdriverIO' has no exported member 'Browser'" when using typescript, add "@wdio/globals/types" into tsconfig.json's "types" array will solve it: { "compilerOptions": { "types": ["@wdio/globals/types"] } }
Parameter params
Options to create the session with
Parameter remoteModifier
Modifier function to change the monad object browser object with sessionId
See Also
Typescript setup
Interfaces
interface Action
interface Action {}
property actions
actions: (NoneActionEntity | PointerActionEntity | KeyActionEntity)[];
property id
id: string;
property parameters
parameters?: { pointerType: 'mouse' | 'pen' | 'touch';};
property type
type?: 'pointer' | 'key';
interface ActionParameter
interface ActionParameter {}
property actions
actions: Action[];
interface AttachOptions
interface AttachOptions extends Omit<WebDriverAttachOptions, 'capabilities'> {}
property capabilities
capabilities: WebDriverAttachOptions['capabilities'];
property options
options: Options.WebdriverIO;
property requestedCapabilities
requestedCapabilities?: WebDriverAttachOptions['capabilities'];
interface Browser
interface Browser extends Omit<BrowserBase, 'on' | 'once'>, BidiEventHandler, BidiHandler, ProtocolCommands, BrowserCommandsType {}
Deprecated
use
WebdriverIO.Browser
instead
interface BrowserBase
interface BrowserBase extends InstanceBase, CustomInstanceCommands<Browser> {}
a browser base that has everything besides commands which are defined for sync and async seperately
property isMultiremote
isMultiremote: false;
interface ChainablePromiseArray
interface ChainablePromiseArray<T> extends Promise<T>, AsyncIterators<T> {}
property length
length: Promise<number>;
Amount of element fetched.
property parent
parent: Promise< WebdriverIO.Element | WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser>;
parent of the element if fetched via
$(parent).$(child)
property selector
selector: Promise<Selector>;
selector used to fetch this element, can be - undefined if element was created via
$({ 'element-6066-11e4-a52e-4f735466cecf': 'ELEMENT-1' })
- a string iffindElement
was used and a reference was found - or a function if element was found via e.g.$(() => document.body)
method [Symbol.asyncIterator]
[Symbol.asyncIterator]: () => AsyncIterableIterator<WebdriverIO.Element>;
index signature
[n: number]: ChainablePromiseElement<WebdriverIO.Element | undefined>;
allow to access a specific index of the element set
interface ChainablePromiseElement
interface ChainablePromiseElement<T> extends ChainablePromiseBaseElement, AsyncElementProto, Promise<T>, Omit< WebdriverIO.Element, keyof ChainablePromiseBaseElement | keyof AsyncElementProto > {}
interface CustomInstanceCommands
interface CustomInstanceCommands<T> {}
method addCommand
addCommand: <IsElement extends boolean = false>( name: string, func: AddCommandFn | AddCommandFnScoped<T, IsElement>, attachToElement?: IsElement, proto?: Record<string, any>, instances?: Record< string, WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser >) => void;
add command to
browser
orelement
scope
method addLocatorStrategy
addLocatorStrategy: ( name: string, func: | ((selector: string, root: HTMLElement) => CustomLocatorReturnValue) | ((selector: string) => CustomLocatorReturnValue)) => void;
create custom selector
method overwriteCommand
overwriteCommand: < ElementKey extends | '$$' | '$' | 'addValue' | 'clearValue' | 'click' | 'custom$$' | 'custom$' | 'doubleClick' | 'dragAndDrop' | 'getAttribute' | 'getCSSProperty' | 'getComputedRole' | 'getComputedLabel' | 'getHTML' | 'getLocation' | 'getProperty' | 'getSize' | 'getTagName' | 'getText' | 'getValue' | 'isClickable' | 'isDisplayed' | 'isDisplayedInViewport' | 'isEnabled' | 'isEqual' | 'isExisting' | 'isFocused' | 'isSelected' | 'isStable' | 'moveTo' | 'nextElement' | 'parentElement' | 'previousElement' | 'react$$' | 'react$' | 'saveScreenshot' | 'scrollIntoView' | 'selectByAttribute' | 'selectByIndex' | 'selectByVisibleText' | 'setValue' | 'shadow$$' | 'shadow$' | 'touchAction' | 'waitForClickable' | 'waitForDisplayed' | 'waitForEnabled' | 'waitForExist' | 'waitForStable' | 'waitUntil', BrowserKey extends | '$$' | '$' | 'custom$$' | 'custom$' | 'react$$' | 'react$' | 'saveScreenshot' | 'touchAction' | 'waitUntil' | 'action' | 'actions' | 'call' | 'debug' | 'deleteCookies' | 'emulate' | 'execute' | 'executeAsync' | 'getCookies' | 'getPuppeteer' | 'getWindowSize' | 'keys' | 'mock' | 'SESSION_MOCKS' | 'CDP_SESSIONS' | 'mockClearAll' | 'mockRestoreAll' | 'newWindow' | 'pause' | 'reloadSession' | 'savePDF' | 'saveRecordingScreen' | 'scroll' | 'setCookies' | 'setTimeout' | 'setWindowSize' | 'switchWindow' | 'throttle' | 'throttleCPU' | 'throttleNetwork' | 'uploadFile' | 'url', IsElement extends boolean = false>( name: IsElement extends true ? ElementKey : BrowserKey, func: | OverwriteCommandFn<ElementKey, BrowserKey, IsElement> | OverwriteCommandFnScoped<ElementKey, BrowserKey, IsElement>, attachToElement?: IsElement, proto?: Record<string, any>, instances?: Record< string, WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser >) => void;
overwrite
browser
orelement
command
interface CustomThrottle
interface CustomThrottle {}
property downloadThroughput
downloadThroughput: number;
property latency
latency: number;
property offline
offline: boolean;
property uploadThroughput
uploadThroughput: number;
interface Element
interface Element extends ElementBase, ProtocolCommands, ElementCommandsType {}
Deprecated
use
WebdriverIO.Element
instead
interface ElementBase
interface ElementBase extends InstanceBase, ElementReference, CustomInstanceCommands<Element> {}
export a browser interface that can be used for typing plugins
property ELEMENT
ELEMENT: string;
WebDriver element reference
property elementId
elementId: string;
WebDriver element reference
property error
error?: Error;
error response if element was not found
property index
index?: number;
index of the element if fetched with
$$
property isMultiremote
isMultiremote: false;
property isReactElement
isReactElement?: boolean;
true if element is a React component
property isShadowElement
isShadowElement?: boolean;
true if element was queried from a shadow root
property parent
parent: WebdriverIO.Element | WebdriverIO.Browser;
parent of the element if fetched via
$(parent).$(child)
property selector
selector: Selector;
selector used to fetch this element, can be - undefined if element was created via
$({ 'element-6066-11e4-a52e-4f735466cecf': 'ELEMENT-1' })
- a string iffindElement
was used and a reference was found - or a functin if element was found via e.g.$(() => document.body)
interface Matches
interface Matches extends Request {}
property body
body: string | Buffer | JsonCompatible;
body response of actual resource
property responseHeaders
responseHeaders: Record<string, string>;
HTTP response headers.
property statusCode
statusCode: number;
HTTP response status code.
interface Mock
interface Mock extends MockFunctions, MockProperties {}
interface MultiRemoteBrowser
interface MultiRemoteBrowser extends MultiRemoteBrowserType {}
Deprecated
use
WebdriverIO.MultiRemoteBrowser
instead
interface MultiRemoteElement
interface MultiRemoteElement extends MultiRemoteElementType {}
Deprecated
use
WebdriverIO.MultiRemoteElement
instead
interface ParsedCSSValue
interface ParsedCSSValue {}
interface Request
interface Request {}
property hasPostData
hasPostData?: boolean;
True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long.
property headers
headers: Record<string, string>;
HTTP request headers.
property initialPriority
initialPriority: ResourcePriority;
Priority of the resource request at the time request is sent.
property isLinkPreload
isLinkPreload?: boolean;
Whether is loaded via link preload.
property method
method: string;
HTTP request method.
property mixedContentType
mixedContentType?: MixedContentType;
The mixed content export type of the request.
property postData
postData?: string;
HTTP POST request data.
property referrerPolicy
referrerPolicy: ReferrerPolicy;
The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/
property url
url: string;
Request URL (without fragment).
property urlFragment
urlFragment?: string;
Fragment of the requested URL starting with hash, if present.
Type Aliases
type ActionTypes
type ActionTypes = 'press' | 'longPress' | 'tap' | 'moveTo' | 'wait' | 'release';
type AddCommandFn
type AddCommandFn = (...args: any[]) => any;
type BrowserCommandsType
type BrowserCommandsType = Omit<$BrowserCommands, keyof ChainablePrototype> & ChainablePrototype;
type ClickOptions
type ClickOptions = { button?: number | string; x?: number; y?: number; skipRelease?: boolean;};
type CustomLocatorReturnValue
type CustomLocatorReturnValue = | HTMLElement | HTMLElement[] | NodeListOf<HTMLElement>;
type CustomStrategyFunction
type CustomStrategyFunction = ( ...args: any) => ElementReference | ElementReference[];
type CustomStrategyReference
type CustomStrategyReference = { strategy: CustomStrategyFunction; strategyName: string; strategyArguments: any[];};
type DragAndDropCoordinate
type DragAndDropCoordinate = { x: number; y: number;};
type DragAndDropOptions
type DragAndDropOptions = { duration?: number;};
type ElementArray
type ElementArray = ElementArrayExport;
type ElementCommandsType
type ElementCommandsType = Omit<$ElementCommands, keyof ChainablePrototype> & ChainablePrototype;
type ElementFunction
type ElementFunction = | ((elem: HTMLElement) => HTMLElement | undefined) | ((elem: HTMLElement) => (HTMLElement | undefined)[]);
type ErrorCode
type ErrorCode = | 'Failed' | 'Aborted' | 'TimedOut' | 'AccessDenied' | 'ConnectionClosed' | 'ConnectionReset' | 'ConnectionRefused' | 'ConnectionAborted' | 'ConnectionFailed' | 'NameNotResolved' | 'InternetDisconnected' | 'AddressUnreachable' | 'BlockedByClient' | 'BlockedByResponse';
type Matcher
type Matcher = { name: string; args: Array<string | object>; class?: string;};
type MixedContentType
type MixedContentType = 'blockable' | 'optionally-blockable' | 'none';
type MockFilterOptions
type MockFilterOptions = { method?: string | ((method: string) => boolean); headers?: | Record<string, string> | ((headers: Record<string, string>) => boolean); requestHeaders?: | Record<string, string> | ((headers: Record<string, string>) => boolean); responseHeaders?: | Record<string, string> | ((headers: Record<string, string>) => boolean); statusCode?: number | ((statusCode: number) => boolean); postData?: string | ((payload: string | undefined) => boolean);};
type MockOverwrite
type MockOverwrite = string | Record<string, any> | MockOverwriteFunction;
type MockOverwriteFunction
type MockOverwriteFunction = ( request: Matches, client: CDPSession) => Promise<string | Record<string, any>>;
type MockResponseParams
type MockResponseParams = { statusCode?: number | ((request: Matches) => number); headers?: | Record<string, string> | ((request: Matches) => Record<string, string>); /** * fetch real response before responding with mocked data. Default: true */ fetchResponse?: boolean;};
type MoveToOptions
type MoveToOptions = { xOffset?: number; yOffset?: number;};
type MultiRemoteBrowserCommandsType
type MultiRemoteBrowserCommandsType = { [K in keyof Omit< BrowserCommandsType, ElementCommandNames | 'SESSION_MOCKS' | 'CDP_SESSIONS' >]: ( ...args: Parameters<BrowserCommandsType[K]> ) => Promise<ThenArg<ReturnType<BrowserCommandsType[K]>>[]>;} & MultiRemoteElementCommands;
type MultiRemoteElementCommandsType
type MultiRemoteElementCommandsType = { [K in keyof Omit<ElementCommandsType, ElementCommandNames>]: ( ...args: Parameters<ElementCommandsType[K]> ) => Promise<ThenArg<ReturnType<ElementCommandsType[K]>>[]>;} & MultiRemoteElementCommands;
type MultiRemoteProtocolCommandsType
type MultiRemoteProtocolCommandsType = { [K in keyof ProtocolCommands]: ( ...args: Parameters<ProtocolCommands[K]> ) => Promise<ThenArg<ReturnType<ProtocolCommands[K]>>[]>;};
type NewWindowOptions
type NewWindowOptions = { windowName?: string; windowFeatures?: string;};
type ReactSelectorOptions
type ReactSelectorOptions = { props?: object; state?: any[] | number | string | object | boolean;};
type ReferrerPolicy
type ReferrerPolicy = | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin';
type RemoteOptions
type RemoteOptions = Options.WebdriverIO & Omit<Options.Testrunner, 'capabilities' | 'rootDir'>;
type ResourcePriority
type ResourcePriority = 'VeryLow' | 'Low' | 'Medium' | 'High' | 'VeryHigh';
HTTP request data. (copied from the puppeteer-core package as there is currently no way to access these types otherwise)
type Selector
type Selector = | string | ElementReference | ElementFunction | CustomStrategyReference | HTMLElement;
type ThrottleOptions
type ThrottleOptions = ThrottlePreset | CustomThrottle;
type ThrottlePreset
type ThrottlePreset = | 'offline' | 'GPRS' | 'Regular2G' | 'Good2G' | 'Regular3G' | 'Good3G' | 'Regular4G' | 'DSL' | 'WiFi' | 'online';
type TouchActionParameter
type TouchActionParameter = string | string[] | TouchAction | TouchAction[];
type TouchActions
type TouchActions = TouchActionParameter | TouchActionParameter[];
type WaitForOptions
type WaitForOptions = { timeout?: number; interval?: number; timeoutMsg?: string; reverse?: boolean;};
type WaitUntilOptions
type WaitUntilOptions = { timeout?: number; timeoutMsg?: string; interval?: number;};
Package Files (3)
Dependencies (24)
- @types/node
- @wdio/config
- @wdio/logger
- @wdio/protocols
- @wdio/repl
- @wdio/types
- @wdio/utils
- archiver
- aria-query
- css-shorthand-properties
- css-value
- devtools-protocol
- grapheme-splitter
- import-meta-resolve
- is-plain-obj
- lodash.clonedeep
- lodash.zip
- minimatch
- puppeteer-core
- query-selector-shadow-dom
- resq
- rgb2hex
- serialize-error
- webdriver
Dev Dependencies (5)
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/webdriverio
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/webdriverio)
- HTML<a href="https://www.jsdocs.io/package/webdriverio"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4471 ms. - Missing or incorrect documentation? Open an issue for this package.