custom$
دستور custom$
به شما امکان میدهد از یک استراتژی سفارشی که با استفاده از browser.addLocatorStrategy
تعریف شده است، استفاده کنید.
برای اطلاعات بیشتر در مورد استراتژیهای انتخابگر سفارشی به مستندات انتخابگر مراجعه کنید.
استفاده
browser.custom$(strategyName, strategyArguments)
پارامترها
نام | نوع | جزئیات |
---|---|---|
strategyName | string | |
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>