- returned "The region checkpoint "StarsLogo" failed. See Details for additional information." and Details is "Cannot get a picture object from the input parameter.".
I'm beginning to believe that TC can't actually do a compare of two images even if they are the same.
At least TC can't compare a stored image to any part of an opened adobe .pdf.
Any pointers (even wrong ones) to help me find the solution are welcome.
So can you region a small part of any .pdf that you have on your network and save that small part in TC as a store, and script (we use JavaScript) opening the same .pdf and comparing the small part of the .pdf that is in the TC store to the opened full .pdf document and get a pass? Then open a different .pdf and get a failure?
This is my objective and what I can't seems to get to work.
I did this instead.
var ManualResults = UserForms.ManualStarsLogoImageCheck.ShowModal(); if ( ManualResults == 6 ) /*Success */ { Log.Message("AR9 meets ER9 'PASS' - The PDF will have a title of 'Checklist'"); ProjectSuite.Variables.ARcount++; } else if ( ManualResults == 2 ) /*View Log */ { Log.Warning("AR9 COULD meet ER9 'WARNING' – Unable top verify that the PDF HAD a title of 'Checklist'"); ProjectSuite.Variables.ERRORcount++; } else if ( ManualResults == 7 ) /*Failure */ { Log.Error("AR9 did NOT meet ER9 'FAILED' - The PDF DID NOT have a title of 'Checklist'"); ProjectSuite.Variables.ERRORcount++; } else { Log.Error("The ManualResults value was not set by the UserForms.ManualReportImageCheck.ShowModal."); }
A_Roskoshnyi I stand corrected! thank you for the clarification
BMD , it looks like the solution above is using Regions.YOURPICTURE.Check() method to check precisely within the prescribed coordinates of your open pdf doc to find the region as described. This will behave as a checkpoint and fail your tests if it does not find it within that region.
While the solution above is using a Keyword test, you can follow the steps shown in the screenshots and right-click convert to script the KDT to get your javascript sample.
Another option would be to use the Regions.Find() method. In this case, you will describe a picture to search in (the open pdf page in question) and the picture you want to find (the logo you stored in the Stores.Region test item). I work the fastest in python so heres my sample (but the syntax should be similar so you can convert most of it into javascript if needed):
def Test3():
#assuming you have the pdf you want to check open on screen, and the "pdf" variable below is referring to that on screen element
pdf = Aliases.AcroRd32.wndAcrobatSDIWindow.AVFlipContainerView.AVDocumentMainView.AVFlipContainerView.AVSplitterView.AVSplitationPageView.AVSplitterView.AVScrolledPageView.AVScrollView.AVPageView
#param1 = picture to search in (in my case entire page of PDF on my screen, aka variable called pdf
#param2 = picture to search for (within the above pdf, aka the logo stored in my Stores-region item as "Logo")
rect = Regions.Find(pdf, "Logo")
if rect != None:
x = rect.Left
y = rect.Top
width = rect.Width
height = rect.Height
pic = pdf.Picture(x,y,width,height)
Log.Picture(pic, "found this image of the Logo")
else:
Log.Error("could not find the logo in your pdf")
the resulting logs will show you:
One final note is that if you change the DPI or resolution of the monitor that the test is created on vs the test being run on, this test will break (which is just the nature of using a pixel based Region method).
Otherwise, hope this helps, and once again, thanks A_Roskoshnyi !
TC cannot compare images via the Regions comparison using stores objects on images on PDFs
TC can only compare images using the methods you are using when TC can recognize the images as an object themselves
At this time I am not aware of any other workarounds - the closest thing that you could potentially do is check the string value of your logo using an OCR checkpoint.