custom$ سفارشی
دستور custom$
به شما امکان میدهد از استراتژی سفارشی که با استفاده از browser.addLocatorStrategy
تعریف شده استفاده کنید.
برای اطلاعات بیشتر در مورد استراتژیهای انتخابگر سفارشی به مستندات Selector مراجعه کنید.
استفاده
$(selector).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')
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
})
برگشتی
- <WebdriverIO.Element>