Modules
WebdriverIO publishes various of modules to NPM and other registries that you can use to build your own automation framework. See more documentation on WebdriverIO setup types here.
webdriver
and devtools
The protocol packages (webdriver
and devtools
) expose a class with the following static functions attached that allow you to initiate sessions:
newSession(options, modifier, userPrototype, customCommandWrapper)
Starts a new session with specific capabilities. Based on the session response commands from different protocols will be provided.
Paramaters
options
: WebDriver Optionsmodifier
: function that allows to modify the client instance before it is being returneduserPrototype
: properties object that allows to extend the instance prototypecustomCommandWrapper
: function that allows to wrap functionality around function calls
Returns
- Browser object
Example
const client = await WebDriver.newSession({
capabilities: { browserName: 'chrome' }
})
attachSession(attachInstance, modifier, userPrototype, customCommandWrapper)
Attaches to a running WebDriver or DevTools session.
Paramaters
attachInstance
: instance to attach a session to or at least an object with a propertysessionId
(e.g.{ sessionId: 'xxx' }
)modifier
: function that allows to modify the client instance before it is being returneduserPrototype
: properties object that allows to extend the instance prototypecustomCommandWrapper
: function that allows to wrap functionality around function calls
Returns
- Browser object
Example
const client = await WebDriver.newSession({...})
const clonedClient = await WebDriver.attachSession(client)