OCR text returns empty text.. but want to continue otherwise

Working through scraping text with the Tesseract OCR, the application I’m working with requires me to scroll down to capture any and all text in the window… however some cases have less text than others, which means as it proceeds to scroll down, it will inevitably come across blank space with no text and return the following error:
image








Is there a way to alleviate this and have the bot continue the next step even though the text it last scraps is blank? It has no problem initially scraping the first text it sees in this window because it is filled with Forms (seen as in the example, but most removed for privacy reasons)










This is the same window with text in it before it scrolls:






This is what the bot seems after it starts scrolling down the page to scrape this entire window:





Here is the window with the error and the properties





Hi @ajeffers ,

You can easily solve this by check-marking the property of “get text ocr” as shown in the screenshot below…

image

Did that and got this as an error return:


image

@ajeffers ,

Continue on error works in run mode not in debug mode.

Another way to ignore this error is by using try catch block.

Put this "Get OCR text " in try block and in catch block add system.exception. Tats it, it catch the error and do ntg.

PS- This works in Run Mode not in debug.

Attempting running this in a regular ‘run mode’ and it prompted the same error:


image

I will try and implement a Try-Catch… assuming this will by pass the error and just continue?

I know because it’s scrolling and as it’s scrolling it’s scraping and that blank space is returning nothing which makes sense… but I need to to continue to keep the text it initially scraped.

Hi @ajeffers ,

Based on my understanding, Continue on error should work. If you configure in such a way as shown in screenshot.
image

If it is not then, use try catch block, i am sure tat solves your need…

hey man I’m facing the exact same issue. For certain scenarios, my OCR scrapes nothing. A try-catch does not solve the issue? have u solved this pproblem??

U can put an if Condition

Let’s say after scrapping with Ocr h store the results in a string varaible output

Then after it to check whether the string is empty or not use if Condition with condition as

output.Equals(" ")

If it is true output is empty

Otherwise

It is not empty

Try this way

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

@sundalpathyREBORN & @ajeffers ,

Use ContinueOnError property or Use Try catch. It solves your need…

Still receiving the same error. :frowning:

I am facing same error please share any example workflow how to perform

I found that I had to put ‘ContinueOnError’ to false, and I had to ‘run the file’ instead of running it in debug mode. I also wrapped this activity inside of a Try Catch. Let me know if that works.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.