ocrGetElementPositionByText
திரையில் உரையின் நிலையைப் பெறுங்கள். இந்த கட்டளை வழங்கப்பட்ட உரையைத் தேடி, Fuse.js-இல் இருந்து ஃபஸி லாஜிக் அடிப்படையில் பொருத்தத்தைக் கண்டறிய முயற்சிக்கும். இதன் பொருள் நீங்கள் தவறான எழுத்துக்களுடன் தேர்வியை வழங்கினாலும், அல்லது கண்டுபிடிக்கப்பட்ட உரை 100% பொருந்தாவிட்டாலும், அது இன்னும் உங்களுக்கு ஒரு கூறை திருப்பித் தர முயற்சிக்கும். கீழே உள்ள பதிவுகளை பார்க்கவும்.
பயன்பாடு
const result = await browser.ocrGetElementPositionByText("Username");
console.log("result = ", JSON.stringify(result, null, 2));
வெளியீடு
முடிவு
result = {
"dprPosition": {
"left": 373,
"top": 606,
"right": 439,
"bottom": 620
},
"filePath": ".tmp/ocr/desktop-1716658199410.png",
"matchedString": "Started",
"originalPosition": {
"left": 373,
"top": 606,
"right": 439,
"bottom": 620
},
"score": 85.71,
"searchValue": "Start3d"
}
பதிவுகள்
# Still finding a match even though we searched for "Start3d" and the found text was "Started"
[0-0] 2024-05-25T17:29:59.179Z INFO webdriver: COMMAND ocrGetElementPositionByText(<object>)
......................
[0-0] 2024-05-25T17:29:59.993Z INFO @wdio/ocr-service:ocrGetElementPositionByText: Multiple matches were found based on the word "Start3d". The match "Started" with score "85.71%" will be used.
விருப்பங்கள்
text
- வகை:
string
- கட்டாயம்: ஆம்
நீங்கள் கிளிக் செய்ய தேட விரும்பும் உரை.
எடுத்துக்காட்டு
await browser.ocrGetElementPositionByText({ text: "WebdriverIO" });
contrast
- வகை:
number
- கட்டாயம்: இல்லை
- இயல்புநிலை:
0.25
கான்ட்ராஸ்ட் அதிகமாக இருக்கும்போது, படம் இருண்டதாகவும், மாறாக இருக்கும்போது வெளிச்சமாகவும் இருக்கும். இது படத்தில் உரையைக் கண்டுபிடிக்க உதவும். இது -1
மற்றும் 1
க்கு இடையில் மதிப்புகளை ஏற்றுக்கொள்கிறது.
எடுத்துக்காட்டு
await browser.ocrGetElementPositionByText({
text: "WebdriverIO",
contrast: 0.5,
});
haystack
- வகை:
number
- கட்டாயம்:
WebdriverIO.Element | ChainablePromiseElement | Rectangle
இது OCR உரையைத் தேட வேண்டிய திரையில் உள்ள தேடல் பகுதியாகும். இது ஒரு கூறாகவோ அல்லது x
, y
, width
மற்றும் height
கொண்ட செவ்வகமாகவோ இருக்கலாம்
எடுத்துக்காட்டு
await browser.ocrGetElementPositionByText({
text: "WebdriverIO",
haystack: $("elementSelector"),
});
// OR
await browser.ocrGetElementPositionByText({
text: "WebdriverIO",
haystack: await $("elementSelector"),
});
// OR
await browser.ocrGetElementPositionByText({
text: "WebdriverIO",
haystack: {
x: 10,
y: 50,
width: 300,
height: 75,
},
});