wswebcreation / wdio-ocr-service

Using Tesseract OCR with WebdriverIO and Appium Native App tests
MIT License
8 stars 4 forks source link

Error is thrown when character is not recognized #18

Open AndreiTsialenchanka opened 2 years ago

AndreiTsialenchanka commented 2 years ago

NOTE: Be aware of the fact that this module is only a plugin that provides all functionality from webdriver-image-comparison. So please check if this is an issue with this plugin or with webdriver-image-comparison.

Environment (please complete the following information):

Config of WebdriverIO + wdio-ocr-service An example of how you configured the wdio-ocr-service : 'ocr', { // The OCR options ocrImagesPath: 'ocr-images/', ocrLanguage: 'eng' },

Describe the bug On some areas of the screen following error is thrown: Error: An error happened when parsing the getSystemOcrData, see: Error: An error happened when parsing the getSystemOcrData, see: Error: Invalid character in entity name Line: 29 Column: 7 Char:

To Reproduce Steps to reproduce the behaviour: Run await driver.ocrGetText()

Expected behavior I expect service to ignore unrecognised characters while parsing the values

Screenshot with cropped out area which causes this error: ios-1667495430812

AndreiTsialenchanka commented 1 year ago

Also I'm getting: "2022-11-18 21:40:09 ERROR Error: An error happened when parsing the getSystemOcrData, see: Error: An error happened when parsing the getSystemOcrData, see: Error: Attribute without value [0-0] Line: 110 [0-0] Column: 14 [0-0] Char: v" error in some cases

wswebcreation commented 1 year ago

Sorry for the late response, do you have a sample I can run?

AndreiTsialenchanka commented 1 year ago

@wswebcreation, sure

  1. open this exact github page in the mobile browser (Screenshot attached),
  2. run the command on iPhone 11 simulator: await driver.ocrGetText()

Error:

Error: Error: An error happened when parsing the getSystemOcrData, see: Error: An error happened when parsing the getSystemOcrData, see: Error: Invalid character in entity name Line: 224 Column: 2 Char:

Screenshot saved by OCR:

ios-1670831723506

Screenshot of the screen in simulator:

Simulator Screen Shot - iPhone 11 - 2022-12-12 at 11 03 56

avient commented 1 year ago

This one might be related as well

Error: Error: An error happened when parsing the getSystemOcrData, see: Error: An error happened when parsing the getSystemOcrData, see: Error: Non-whitespace before first tag.
                Line: 0
                Column: 1
                Char: 1