custom$
Polecenie custom$
pozwala na używanie niestandardowej strategii zadeklarowanej za pomocą browser.addLocatorStrategy
.
Więcej informacji na temat niestandardowych strategii selektorów znajdziesz w dokumentacji Selektorów.
Użycie
browser.custom$(strategyName, strategyArguments)
Parametry
Nazwa | Typ | Szczegóły |
---|---|---|
strategyName | string | |
strategyArguments | * |
Przykłady
customStrategy.js
loading...
example.html
loading...
customStrategy.js
loading...
example.js
it('should fetch the project title', async () => {
await browser.url('https://webdriver.io')
browser.addLocatorStrategy('myStrat', (selector) => {
return document.querySelectorAll(selector)
})
const projectTitle = await browser.custom$('myStrat', '.projectTitle')
console.log(await projectTitle.getText()) // WEBDRIVER I/O
})
Zwraca
- <WebdriverIO.Element>