Image Validation


SUBMITTED BY: rilp44

DATE: Dec. 5, 2015, 1:55 a.m.

FORMAT: Text only

SIZE: 7.9 kB

HITS: 2181

  1. == Image Validation [[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]] [[Image:Ff-icon.png|Firefox]] [[Image:Cr-icon.png|Chrome]]==
  2. Powerful image validation support(sometimes also called visual search or pattern recognition) is part of the iMacros business editions. It adds two new, extremely powerful commands. The use of image validation is recommended if you need to test web sites with non-html based functions, such as Macromedia Flash (Shockwave) or Java applets. Unlike [[DS|DirectScreen]] commands the [[IMAGESEARCH]] and [[IMAGECLICK]] commands do not rely on the coordinates of an element but on its visual appearance. Thus buttons and input boxes can be found even if they move around on the screen.
  3. [[Image:Imagesearch.png|frame|Image Search Menu]]
  4. The Image Validation menu entries allow you to create and test input images for the new image validation commands.
  5. Image Validation does not only work with "real" images, but also with text, buttons or any other element that is inside the web browser window!
  6. Demo movie: [http://forum.iopus.com/_uploads/ImageRecognition.htm Web Testing on Disney.com]
  7. == Image Validation Wizard ==
  8. [[File:Image recognition wizard.png]]
  9. * The Image Validation wizard can be launched from an instance of the iMacros Browser. It can also be launched from the iMacros Browser or IE, while recording is in progress. Note however, the wizard cannot be launched from Firefox or Chrome
  10. * The wizard opens with a screenshot of the page which is currently open in the browser.
  11. * If you check the box "Only visible page area", a new screenshot is taken containing only the part of the page which is currently visible on the browser.
  12. * After you are satisfied with the screenshot, you can either choose an image file which was previously saved, or you can select a piece of the screenshot.
  13. * If the image you want to select is too small, you can enable the "zoom picker" above [[File:IRZoom.png|150px]].
  14. * To select an image for further search, the "select picker" has to be enabled [[File:IRSelect.png|150px]]. Now just hold down the left mouse button at the top left corner of the desired selection and drag it until the bottom right corner.
  15. * As soon as you release the left mouse button, the selected area is shown on the right panel.
  16. * The check box "Zoom to fit" performs a zoom of the selected image either in or out until it fits in that space. The aspect ratio is kept.
  17. * The new image is not yet saved to disk and cannot yet be searched on the page screenshot. Save it first. The Wizard suggests a file name based on the current time, but you can change that name, for that just edit the text box containing the image name.
  18. * A mouse click over the screenshot cancels any previous selection or drawn search results.
  19. * When the "Save & Search" button is pressed a search is automatically done. Also every slider movement (to adjust the confidence threshold) triggers a search.
  20. * If you choose an image previously saved in the file name drop-down, a search is automatic performed as soon as you close the drop down.
  21. * If you change the confidence threshold with the keyboard arrow keys (finer changes!), do not forget to click over the slider button to trigger a new search.
  22. * The found matches are shown on the screenshot numbered according to their position. The position numbers are the same as iMacros uses in IMAGESEARCH POS=...
  23. * A more detailed information about the matches appears on the Wizard Feedback box [[File:IRFeedbackBox.png|150px]]
  24. * The buttons "Test Command(s)" and "Add Command(s)" test the macro command as in "Suggested Command(s)", in the browser window, or add it to the macro which is currently being recorded.
  25. == Search and Click Images/Buttons ==
  26. The commands IMAGESEARCH and IMAGECLICK are active after the Image Validation Plugin installation.
  27. === Search for an image on a website ===
  28. The command to search certain images on a website is called IMAGESEARCH and has two parameters, IMAGE and CONFIDENCE. The command works by searching for the appearance of an image on the web site, which is saved locally on your hard drive. The parameter IMAGE sets the image that the Plugin searches for. The parameter CONFIDENCE tells the Plugin how close the image must match the image on the website. A confidence level of 100 means that the input image and the image on the website must be 100% identical - an exact match; otherwise the IMAGESEARCH command generates an ERROR. A confidence level of less than 100, e.g. 95, allows for some deviation in the color of the image, or a change in the image background or foreground colors.
  29. === Click (or send text) to a certain area of the website (defined by an image) ===
  30. The command to click or send content to an image on a web site is called IMAGECLICK. This command has three parameters, IMAGE, CONFIDENCE and CONTENT. The command works by searching for the appearance of an image on the web site, which is saved locally on your hard drive. If this image, supplied by the IMAGE parameter, is found, the CONTENT is send to it. The parameter CONFIDENCE has the same function as in the IMAGESEARCH command.
  31. The IMAGECLICK command is a combination of [[IMAGESEARCH]] and [[DS]] CMD=CLICK. The following example shows the connection:
  32. IMAGESEARCH IMAGE=pic1.bmp CONFIDENCE=95
  33. DS CMD=CLICK X=<nowiki>{{!IMAGEX}}</nowiki> Y=<nowiki>{{!IMAGEY}}</nowiki> CONTENT=
  34. [[Image:Imageclick.png|left|frame|Fig 1: Coordinates returned by IMAGESEARCH]]
  35. The internal variables !IMAGEX and !IMAGEY are the X/Y coordinates of the middle of the position where the "pic1.bmp" image was found. They are set by the IMAGESEARCH command.
  36. === Some comments on the CONFIDENCE parameter ===
  37. A confidence level of less than 100 means that the input image does not have to match the image found on the web page exactly. Deviations in color or shape are allowed. The lower the confidence level, the more deviations are allowed. If you simply want to ignore color changes, a CONFIDENCE level of 95 is recommended. If you lower the confidence level too much, iMacros will detect the wrong image as an acceptable match. For typical web testing applications, levels between 50 and 99 have proven to be useful. Since, the search algorithm uses advanced image recognition technology it is not as fast as a CONFIDENCE=100 search. Also, the search time increases with input image size. Typical search times are between 1-3 seconds on a PC with a 2.5 GHz CPU.
  38. == Example: Automate Flash Chat Web Applet ==
  39. [[Image:Image-recognition-plugin.png|thumb|150px|Flash Chat Example]]
  40. The diagram shows you that only three images and three lines of macro code are required to automate input into a flash (or Java) based chat applet. The picture below indicates that the procedure to create images for IMAGESEARCH has been done for the three elements.
  41. This example includes a verification that the input is received.
  42. The macro for this application is:
  43. 'Fill text into input box
  44. IMAGECLICK POS=1 IMAGE=inputbox.bmp CONFIDENCE=95 CONTENT=Hello<SP>Heidelberg
  45. 'Click "send" button
  46. IMAGECLICK POS=1 IMAGE=sendbutton.bmp CONFIDENCE=95
  47. 'Now test if the applet works => look for text "Heidelberg" in applet window
  48. IMAGESEARCH POS=1 IMAGE=text.bmp CONFIDENCE=95
  49. If you add STOPWATCH commands to this macro, it can be used to measure the performance of the Flash (or Java) applet.
  50. == See Also ==
  51. * [http://wiki.imacros.net/FAQ#Q:_What_factors_can_cause_a_macro_that_uses_DirectScreen_or_image_recognition_to_fail_on_different_machines.3F What factors can cause the image recognition or DirectScreen to fail on one machine whereas it is working on others?]
  52. * [http://forum.iopus.com/viewtopic.php?t=9543 Which technologies are supported in tray/silent mode]

comments powered by Disqus