Aller au contenu principal

custom$$

Le customs$$ vous permet d'utiliser une stratégie personnalisée déclarée en utilisant browser.addLocatorStrategy. Pour en savoir plus sur les stratégies de sélecteur personnalisées, consultez la documentation des sélecteurs.

Utilisation
$(selector).custom$$(strategyName, strategyArguments)
Paramètres
NomTypeDétails
strategyNamestring
strategyArguments*
Exemple
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
})
Retourne
  • <WebdriverIO.ElementArray>

Welcome! How can I help?

WebdriverIO AI Copilot