Forum Discussion
I do not agree that "Region Checkpoint" does not work, look at my screenshots I made specifically for you.
I want to immediately note that for correct work you need a license for "Intelligent Quality Add-On".
1. add region checkpoint to test2. select window region in pdf3. auto generated checkpoint with coordinates4. result
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.");
}
Thank you, BMD
- hkim54 years agoStaff
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 !
Related Content
- 2 years ago
- 2 years ago
- 5 years ago
- 7 years ago