custom$$
Il customs$$
consente di utilizzare una strategia personalizzata dichiarata utilizzando browser.addLocatorStrategy
.
Leggi di più sulle strategie di selezione personalizzate nella documentazione dei Selettori.
Utilizzo
browser.custom$$(strategyName, strategyArguments)
Parametri
Nome | Tipo | Dettagli |
---|---|---|
strategyName | string | |
strategyArguments | * |
Esempio
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
})
Restituisce
- <WebdriverIO.ElementArray>