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>