fbpx

OCR on simple text

OCR on simple text

Home Forums Ask Expert OCR on simple text

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #31674
    Jonathan Borthwick
    Participant

      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:

      #31675
      Jonathan Borthwick
      Participant

        FYI, 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.

        #31676
        Kirill Bulatnikov
        Participant

          Hi jborthwick
          Can you please provide script itself or at least part of the script text for lines 24 to 33?

          Thanks,
          ZAPTEST Team

          #31677
          Kirill Bulatnikov
          Participant

            BTW 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 Team

            #31678
            Jonathan Borthwick
            Participant

              var 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”);
              }

              #31679
              Jonathan Borthwick
              Participant

                I 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

                #31680
                Jonathan Borthwick
                Participant

                  The 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.

                  #31681
                  Kirill Bulatnikov
                  Participant

                    Okay, 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.

                    #31682
                    Jonathan Borthwick
                    Participant

                      Taking 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:
                      #31683
                      Kirill Bulatnikov
                      Participant

                        For 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 Team

                        Attachments:
                      Viewing 10 posts - 1 through 10 (of 10 total)
                      • You must be logged in to reply to this topic.

                      Virtual Expert

                      ZAPTEST

                      ZAPTEST Logo