custom$$
customs$$
は、browser.addLocatorStrategy
を使用して宣言されたカスタム戦略を使用することを可能にします。
カスタムセレクタ戦略についての詳細はセレクタドキュメントを参照してください。
使用法
browser.custom$$(strategyName, strategyArguments)
パラメータ
名前 | 型 | 詳細 |
---|---|---|
strategyName | string | |
strategyArguments | * |
例
example.js
it('should get all the plugin wrapper buttons', async () => {
await browser.url('https://webdriver.io')
await browser.addLocatorStrategy('myStrategy', (selector) => {
return document.querySelectorAll(selector)
})
const pluginWrapper = await browser.custom$$('myStrategy', '.pluginWrapper')
console.log(await pluginWrapper.length) // 4
})
戻り値
- <WebdriverIO.ElementArray>