custom$
custom$ は、browser.addLocatorStrategy を使用して宣言されたカスタム戦略を使用できるようにします。カスタムセレクタ戦略の詳細については、セレクタドキュメントをご覧ください。
使用法
$(selector).custom$(strategyName, strategyArguments)
パラメータ
| 名前 | 型 | 詳細 | 
|---|---|---|
| strategyName | 文字列 | |
| strategyArguments | param | 
例
customStrategy.js
loading...
example.html
loading...
customStrategy.js
loading...
example.js
it('should fetch the project title', async () => {
    await browser.url('https://webdriverio.dokyumento.jp')
    await browser.addLocatorStrategy('myStrat', (selector) => {
        return document.querySelectorAll(selector)
    })
    const header = await browser.custom$('myStrat', 'header')
    const projectTitle = await header.custom$('myStrat', '.projectTitle')
    console.log(projectTitle.getText()) // WEBDRIVER I/O
})