OCR on simple text
Home › Forums › Ask Expert › OCR on simple text
- This topic has 9 replies, 2 voices, and was last updated 6 years, 9 months ago by Kirill Bulatnikov.
-
AuthorPosts
-
March 5, 2018 at 11:28 pm #31674Jonathan BorthwickParticipant
I have a Zaptest script and a website. I am using JavaScript for the language in Zaptest free.
Zaptest has scanned the site, and I have set up a parent child relationship to a numerical field. See attachment.
The script produces a summary results saying that there is an error doing this basic OCR.I have some custom reports based on the values the ocr reads but of course the ocr doesn’t detect anything .What could I be doing wrong? Let me know if there are any other files that I could provide to help diagnose what I’m doing wrong.
Thanks,
Jonathan Borthwick:unsure:
Attachments:March 5, 2018 at 11:31 pm #31675Jonathan BorthwickParticipantFYI, the notepad file opens fine. My script is to compare the numerical value on a site after a click with a value in a dynamic text file. I have set up this ocr gettext on a fields in the website and a field on the text file. ocr is not working on either.
March 5, 2018 at 11:55 pm #31676Kirill BulatnikovParticipantHi jborthwick
Can you please provide script itself or at least part of the script text for lines 24 to 33?Thanks,
ZAPTEST TeamMarch 6, 2018 at 12:09 am #31677Kirill BulatnikovParticipantBTW is your script operates with the same browser window or it enable some pop up window(s)?
The error looks like problem is in application that cannot be found via ZAPTEST.Thanks,
ZAPTEST TeamMarch 6, 2018 at 12:20 am #31678Jonathan BorthwickParticipantvar url = “https://supplierportal-beta.creationtech.com/Home/SPortal”;
var browser = “chrome”;
var testResultNotepad = “C:TestNotepadFileShortcut.lnk”var expectedtotalPOs = 3988;
var webAppPOTotal = 0;
var directOraclePOTotal = 0;//launch chrome with the supplier portal url
Application(“SupplierPortal”).Launch(browser,url);//click second supplier
Application(“SupplierPortal”).View(“SPChrome”).Object(“Supplier2”).Click();var webAppPOTotalText = Application(“SupplierPortal”).View(“SPChromeSuppliersAndFilters”).Object(“GrandTotalLabel”).Object(“expectedPOTotalObject”).GetText(true);
Application(“SupplierPortal”).Launch(testResultNotepad);
var directOraclePOTotalText = Application(“SupplierPortal”).View(“ExpectedPOResult”).Object(“expectedTotalLabel”).Object(“directPOTotalObject”).GetText(true);
if(webAppPOTotal >0 && directOraclePOTotal >0){
if(webAppPOTotal != directOraclePOTotal){
Application(“SupplierPortal”).CustomReport(false,”Expected PO check”,”Expected PO of ‘” + directOraclePOTotal + “‘ is different to Customer portal total PO of ‘” + webAppPOTotal + “‘”);
}else{
Application(“SupplierPortal”).CustomReport(true,”Expected PO check”,”Expected PO is the same as Customer portal total PO”);
}
}else{
Application(“SupplierPortal”).CustomReport(false,”Expected PO check”,”Could not do OCR on targeted text areas”);
}March 6, 2018 at 12:21 am #31679Jonathan BorthwickParticipantI havent yet parsed the text that the ocr is meant to retrieve for me. When and if i do get that ocr text, ill be parsing the text to numbers and assigning them to the webAppPOTotal and directOraclePOTotal variables
March 6, 2018 at 12:27 am #31680Jonathan BorthwickParticipantThe first OCR error is on a browser.
I then open a text file and do a second ocr.
The click works. It then tries to look at the po total value on the same page that the click worked.March 6, 2018 at 12:41 am #31681Kirill BulatnikovParticipantOkay, here are my suggestions
1. When you are using “click”, “type” or “gettext” methods with instantly opened page try to insert some “exist” steps before – there is a big chance that object just not appears yet (page not yet loaded) that’s why step may fail.
2.You are using 2 applications within single script therefore you need to re-scan 2nd application (notepad in your case) in the different “Application” in the repository explorer. Currently when you’re mixing 2 different applications under test within same “Application” in the repository explorer it may cause mismatch of the application detection related to “regexpwndclass” and “regexpwndtitle” properties of applications.
Hope that helps.
Thanks,
ZAPTEST Team.March 6, 2018 at 3:20 am #31682Jonathan BorthwickParticipantTaking the advice and doing an exists test for the web page part, ocr worked on the web site field. I also took the advice to make a new view for the notepad and I did an exists on that as well. The script does open it, it does pass the exists but for the notepad window, the ocr part fails. See attached.
Is there something im doing wrong or am I stuck with only being able to access ocr for a single gui? Im just trying to get it to ‘read’ the 3988 value from the text file.
I would expect that the opened text file eg results.txt would be able to read 3989 and assign it to the variable expectedPoText, but it becomes empty string. I did re-scan the notepad one.
Help?Attachments:March 6, 2018 at 11:08 am #31683Kirill BulatnikovParticipantFor the notepad application you need an “Application” and not just a new view. When you doing scan of the GUI first you prompted about application – click to the drop-down list and select “Create new” – thus your view will be added to the new “Application”.
Please check the screenshot attached.Thanks,
ZAPTEST TeamAttachments: -
AuthorPosts
- You must be logged in to reply to this topic.