メインコンテンツにスキップ

custom$$

customs$$は、browser.addLocatorStrategyを使用して宣言されたカスタム戦略を使用することを可能にします。 カスタムセレクタ戦略についての詳細はセレクタドキュメントを参照してください。

使用法
browser.custom$$(strategyName, strategyArguments)
パラメータ
名前詳細
strategyNamestring
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>

Welcome! How can I help?

WebdriverIO AI Copilot