انتقل إلى المحتوى الرئيسي

custom$

يتيح لك custom$ استخدام استراتيجية مخصصة تم إعلانها باستخدام browser.addLocatorStrategy. اقرأ المزيد عن استراتيجيات المحدد المخصصة في وثائق المحدد.

الاستخدام
$(selector).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')
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>

Welcome! How can I help?

WebdriverIO AI Copilot