مخصص$
يسمح لك 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>