メインコンテンツにスキップ

custom$

custom$ を使用すると、browser.addLocatorStrategy を使用して宣言したカスタム戦略を使用できます。 カスタムセレクタ戦略の詳細については、セレクタドキュメントをご覧ください。

使用法
browser.custom$(strategyName, strategyArguments)
パラメータ
名前タイプ詳細
strategyNamestring
strategyArguments*
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
})
戻り値
  • <WebdriverIO.Element>

Welcome! How can I help?

WebdriverIO AI Copilot