Was this page helpful?

Bitmap / OCR searching failure (succeeded on NTBR)


    You may sometimes find that the bitmap searching or OCR searching function works well on your development environment but it fails when you export the script onto your probes.

    Here are some possible causes.


    Case 1: Screen color and resolution

    The first thing to which you need to pay attention is the screen color and resolution.

    In fact, bitmap searching is based on searching zone restrictions (if you defined a restriction zone) and pixel comparsion. If screen scales are different between development machine and probe machine, you may get searching failure.

    Here's an example that screen resolution may cause bitmap searching failure :

    On a 1024*768 screen, we created our bitmap searching function with Script Wizard to search for "Cancel" button on the Chrome pop-up. We defined a restriction zone on that pop-up (c.f. the following image).



    We changed the screen resolution to 1152*864 and re-edit the same function. Here you can see:


    The "Cancel" button is now out of the restriction zone.

    You may ask: If I don't use restriction on my searching, it would be OK to have different resolutions, no ?

    The answer is NO. You will still need to pay attention to screen resolutions.

    Here's another example:

    If you take a close look at the following two bitmaps (first one is captured on 1920*1080 resolution, second one is captured on a 1152*864 resolution on the same machine), you may find that pixels' colours and even numbers of pixels are different from one and another.


    This proves well that screen resolution may have impact on bitmap searching or sometimes OCR searching (if pixels' color are much modified. To reduce the impact, please check the next section : 1.2 Cleartype option and font smoothing) even without restriction zone.

    You may use the following code to save bitmap search result in order to compare :

    SetArgInt("Bitmap.KeepTempFile", 1)​


    Note: Screen resolution may change when you use a remote connection tool.



    We suggest you to set the same resolution on all your Newtest machines (NTBR or Robot machines) and use a VNC viewer for remote connection. Normally VNC viewer does not change screen display or resolution during remote connections (some of them may change slightly color display).


    Case 2: Cleartype option and font smoothing

    For OS later than Windows 7 (included), the system has features to smooth or modify how font looks like on your screen. So if you are using bitmap searching for text strings, these functionalities might lead the failure of your searching from one to another machine.
    Here's an example :
    First "about:blank" is captured when Cleartype option and font smoothing option are activated. Second one is captured after having disabled these two features :
    It is quite obvious that these options have changed a lot on font image pixels. As a bitmap searching is based on pixel comparsion, you may then get failures because of them.


    We suggest you to disable Cleartype and font smoothing on all your machines. Here's how you can do it :

    - Disable Cleartype

    In Control Panel -> Appearance and Personalisation -> Display (or Fonts) -> Adjust ClearType text


    Uncheck "Turn on Clear type" and click on "Next" directly until "Finish" button apears and finish your modification.


    - Disable font smoothing

    You may disable font smoothing trough Control Panel -> System and Security -> System -> System protection -> Advanced -> Performance Settgins or you may search directly "performance" in windows menu and click on proposed "Adjust the appearance and performance of Windows".


    performance settgins.png

    Uncheck the "Smooth edges of screen fonts" option and click on "OK" button to confirm the change.


    See also

    Was this page helpful?
    Tag page (Edit tags)
    • No tags
    Page statistics
    3626 view(s), 7 edit(s) and 8845 character(s)


    You must login to post a comment.