custom$$
customs$$
を使用すると、browser.addLocatorStrategy
で宣言したカスタム戦略を使用できます。
カスタムセレクタ戦略の詳細については、セレクタドキュメントをご覧ください。
使用方法
$(selector).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('myStrat', (selector) => {
return document.querySelectorAll(selector)
})
const pluginRowBlock = await browser.custom$('myStrat', '.pluginRowBlock')
const pluginWrapper = await pluginRowBlock.custom$$('myStrat', '.pluginWrapper')
console.log(pluginWrapper.length) // 4
})
戻り値
- <WebdriverIO.ElementArray>