OCR Image Not Found

How do I get this to work?

I see the image when I select the action and have set up the anchor and capture regions. I’ve tried this with multilple PDFs.

Error executing OcrAction
  com.workfusion.studio.rpa.recorder.playback.PlaybackException: Error executing TemplateAction[templateName=OcrAction.ftl,id=11,name=Optional[OcrAction],parent=-2,nextSibling=12,arguments=ActionArguments[varName=[campaignname],imageName=[C:\\trash\\workfusion-workspace\\rpae_project\\ocr_automation\\1534702135232-anchor-1534702135629.apng],fullImageName=[1534702135232.png],xsi:type=[recorder:OcrAction, recorder:OcrAction],pollingInterval=[300],active=[true],type=[CONTROL],offsetX=[309],offsetY=[522],delay=[0],width=[112],actionDetails=[(to 'campaignname' rectangle 112 x 21)],height=[21],awaitTimeout=[5000]]]
      at com.workfusion.studio.rpa.recorder.playback.flow.StandardControlFlow.execute(StandardControlFlow.java:54)
      at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:28)
      at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:15)
      at com.workfusion.studio.rpa.recorder.playback.player.ActionPlayer.next(ActionPlayer.java:53)
      at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.playNextAction(PlaybackLogic.java:152)
      at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.run(PlaybackLogic.java:112)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: org.openqa.selenium.WebDriverException: Image not found : 1534702135232-anchor-1534702135629.apng
Command duration or timeout: 0 milliseconds
Build info: version: '9.0.0.4', revision: 'e6e278acd9', time: '2018-06-19T14:40:11.651Z'
System info: host: 'SPA-PC', ip: '192.168.86.38', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: com.freedomoss.crowdcontrol.webharvest.selenium.wrapper.RemoteDriverWrapper
Capabilities [{imageSimilarityThreshold=0.8, extra.executor.id={Name=RPA Recorder}, CLOSE_ALL_WINDOWS=false, browserName=universal, javascriptEnabled=true, extra.capabilities.context={"browserType":"universal","startInPrivate":false,"blockImages":false,"maximizeOnStartup":false,"customCapabilities":{"platform":"WINDOWS","javascriptEnabled":true,"SEARCH_ALL_WINDOWS":true,"CLOSE_ALL_WINDOWS":false,"imageSimilarityThreshold":"0.8"},"executorId":{"Name":"RPA Recorder"}}, platformName=WINDOWS, SEARCH_ALL_WINDOWS=true, platform=WINDOWS}]
Session ID: 3cfb9aca-8efb-4283-9f37-35c33f5098f7
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
      at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:41)
      at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:82)
      at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:45)
      at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:656)
      at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:592)
      at com.workfusion.rpa.helpers.RPA.executeScript(RPA.java:864)
      at com.workfusion.rpa.helpers.RPA.executeGroovyScript(RPA.java:930)
      at com.workfusion.rpa.helpers.ImageElement.findImageRectangle(ImageElement.java:183)
      at com.workfusion.rpa.helpers.ImageElement.getRect(ImageElement.java:86)
      at com.workfusion.rpa.helpers.UiElement.getRect(UiElement.java:1025)
      at org.openqa.selenium.WebElement$getRect$0.call(Unknown Source)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
      at Script7.run(Script7.groovy:5)
      at com.workfusion.studio.rpa.recorder.playback.shell.GroovyShellWrapper.executeScript(GroovyShellWrapper.java:90)
      at com.workfusion.studio.rpa.recorder.playback.player.PlaybackContext.executeScript(PlaybackContext.java:65)
      at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.executeBehavior(TemplateAction.java:33)
      at com.workfusion.studio.rpa.recorder.playback.flow.StandardControlFlow.execute(StandardControlFlow.java:46)
      at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:28)
      at com.workfusion.studio.rpa.recorder.playback.action.template.TemplateAction.execute(TemplateAction.java:15)
      at com.workfusion.studio.rpa.recorder.playback.player.ActionPlayer.next(ActionPlayer.java:53)
      at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.playNextAction(PlaybackLogic.java:152)
      at com.workfusion.studio.rpa.recorder.player.PlaybackLogic.run(PlaybackLogic.java:112)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: java.util.NoSuchElementException: Image not found : 1534702135232-anchor-1534702135629.apng
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
      at org.codehaus.groovy.reflection.CachedConstructor.doConstructorInvoke(CachedConstructor.java:77)
      at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrap.callConstructor(ConstructorSite.java:84)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:247)
      at Script1$1.call(Script1.groovy:12)
      at Script1$1.call(Script1.groovy)
      at com.workfusion.common.utils.SynchUtils.withFocusLock(SynchUtils.java:47)
      at com.workfusion.common.utils.SynchUtils$withFocusLock.call(Unknown Source)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:133)
      at Script1.run(Script1.groovy:5)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
      at com.workfusion.autoit.driver.AutoItDriver.executeGroovyScript(AutoItDriver.java:239)
      at com.workfusion.autoit.driver.AutoItDriver.executeScript(AutoItDriver.java:207)
      at com.workfusion.autoit.driver.AutoItDriver.executeScript(AutoItDriver.java:183)
      at com.workfusion.universal.driver.UniversalDriver.executeScript(UniversalDriver.java:149)
      at org.openqa.selenium.remote.server.handler.ExecuteScript.call(ExecuteScript.java:54)
      at org.openqa.selenium.remote.server.handler.WebDriverHandler.handle(WebDriverHandler.java:41)
      at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:133)
      at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:203)
      at org.openqa.selenium.remote.server.InMemorySession.execute(InMemorySession.java:98)
      at org.openqa.selenium.remote.server.WebDriverServlet.lambda$handle$0(WebDriverServlet.java:231)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
1 Like

Hi @Sunil_Ahuja2, can you share the details of the OCR action and the pdf file you use it on?

I can’t share the PDF file. Are there limitations which what PDF file types can be parsed/read from? I tried an airline boarding pass and it worked and another one which I need to OCR it does not.

The one that doesn’t work…

The one that does work

image

Does the tagging or any other information matter?

@Sunil_Ahuja2 what Anchor and Capture regions did you use for both images?

The one that does not work

image

The one that works

image

There are no actual images on the screen shots. Please share the screenshots of the ocr actions with action details

This one doesn’t work

It goes through the first few steps since the file exists and then fails with the error on the original post

image

This one works

@Sunil_Ahuja2 perhaps, the Anchor region in the first image was a bit different so the bot didn’t recognize it? The Anchor image has to be the same in the OCR action and in the pdf document you try to ocr.

Is there a way to confirm that? I’ve setup Anchor and Capture multiple times already. Is there something you can recommend to troubleshoot? Maybe checking outside the tool v/s runtime or anything else.

@Sunil_Ahuja2 the best practices for this would be:

  • to make sure that the image has the time to load before the ocr action, if required - set a bigger timeout for OCR actions
  • make sure that the image used in the OCR action and the image on the screen are of the same scale
  • make sure that the Anchor region is the same in the image used in the OCR action and the image on the screen.

For example:

This anchor image might not work as the name of the file is included in the anchor region, and the name can be different

This image will work as the icon is always the same, and the name that can change is not used as an anchor region

Hope it will be helpful

1 Like