ocrWaitForTextDisplayed
انتظر ظهور نص محدد على الشاشة.
الاستخدام
await browser.ocrWaitForTextDisplayed({
text: "specFileRetries",
});
المخرجات
السجلات
[0-0] 2024-05-26T04:32:52.005Z INFO webdriver: COMMAND ocrWaitForTextDisplayed(<object>)
......................
# ocrWaitForTextDisplayed uses ocrGetElementPositionByText under the hood, that is why you see the command ocrGetElementPositionByText in the logs
[0-0] 2024-05-26T04:32:52.735Z INFO @wdio/ocr-service:ocrGetElementPositionByText: Multiple matches were found based on the word "specFileRetries". The match "specFileRetries" with score "100%" will be used.
الخيارات
text
- النوع:
string - إلزامي: نعم
النص الذي تريد البحث عنه للنقر عليه.
مثال
await browser.ocrWaitForTextDisplayed({ text: "specFileRetries" });
timeout
- النوع:
number - إلزامي: لا
- القيمة الافتراضية: 18000 (18 ثانية)
الوقت بالميلي ثانية. انتبه إلى أن عملية التعرف الضوئي على النصوص قد تستغرق بعض الوقت، لذا لا تضبطها على قيمة منخفضة جدًا.
مثال
await browser.ocrWaitForTextDisplayed({
text: "specFileRetries"
timeout: 25000 // انتظر 25 ثانية
});
timeoutMsg
- النوع:
string - إلزامي: لا
- القيمة الافتراضية:
Could not find the text "{selector}" within the requested time.
يتجاوز رسالة الخطأ الافتراضية.
مثال
await browser.ocrWaitForTextDisplayed({
text: "specFileRetries"
timeoutMsg: "My new timeout message."
});
contrast
- النوع:
number - إلزامي: لا
- القيمة الافتراضية:
0.25
كلما زاد التباين، أصبحت الصورة أكثر قتامة والعكس صحيح. هذا يمكن أن يساعد في العثور على نص في الصورة. يقبل قيم بين -1 و 1.
مثال
await browser.ocrWaitForTextDisplayed({
text: "specFileRetries",
contrast: 0.5,
});
haystack
- النوع:
number - إلزامي:
WebdriverIO.Element | ChainablePromiseElement | Rectangle
هذه منطقة البحث في الشاشة حيث يحتاج التعرف الضوئي البحث عن النص. يمكن أن يكون عنصرًا أو مستطيلًا يحتوي على x و y و width و height