Перейти до основного вмісту

addInitScript

Callback to emit data from the browser back to the Node.js environment. In order to receive the data returned by the callback function you have to listen to the data event, e.g.

const script = await browser.addInitScript((emit) => {
emit('hello')
})
script.on('data', (data) => {
console.log(data) // prints: hello
})
Usage
browser.addInitScript(data)
Parameters
NameTypeDetails
dataanyThe data to emit.

Welcome! How can I help?

WebdriverIO AI Copilot