custom$
The custom$
allows you to use a custom strategy declared by using browser.addLocatorStrategy
Usage
$(selector).custom$(strategyName, strategyArguments)
Parameters
Name | Type | Details |
---|---|---|
strategyName | String | |
strategyArguments | Any |
Example
it('should fetch the project title', () => {
browser.url('https://webdriver.io')
browser.addLocatorStrategy('myStrat', (selector) => {
return document.querySelectorAll(selector)
})
const header = browser.custom$('myStrat', 'header')
const projectTitle = header.custom$('myStrat', '.projectTitle')
console.log(projectTitle.getText()) // WEBDRIVER I/O
})