Vai al contenuto principale

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
NomeTipoDettagli
strategyNamestring
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>

Welcome! How can I help?

WebdriverIO AI Copilot