How to make QTP “analog mode” steps more reliable

We all know that “analog” is widely considered a dirty word when it comes to QTP scripting. It is very sensitive to changes in the environment in which the script is executed, such as objects that were moved in the window, changes to screen resolution or changes to window size & position. We can’t do much when it comes to the first problem, but there is a simple trick that should eliminate the problems caused by changes to the window size and position, and in some cases screen resolution;

When you start recording in analog mode, select the option to record relative to the window. This will eliminate some of the window position problems but is still prone to failure. To (mostly) eliminate these problems, record a “Move” step and a “Resize” step for the window, e.g.:

1
2
Window(“Paint”).Move 0,0
Window(“Paint”).Resize 859,632

This is good and well if we are working with Windows applications, but what about web browsers? There are no “Move” or “Resize” methods for the Browser class. In this case you can invoke the “Move” and “Resize” methods using the browser’s native Window class:

1
2
3
pagetitle = Browser("YourBrowser").GetROProperty("title")
Window("regexpwndclass:=IEFrame","title:=" & pagetitle).Move 0,0
Window("regexpwndclass:=IEFrame","title:=" & pagetitle).Resize 859,632

This will ensure that the window has a constant size and position every time the script is executed, and in some cases this may even eliminate issues caused by differences in screen resolution. When pop-up windows or dialogs appear it’s probably a good idea to exit out of analog mode and record a resize and/or move of the window / dialog before continuing in the analog mode. Having said that, analog mode should only be used in cases when normal or low level recording does not work, and a pop-up window should not have this problem.

 


Related posts:

  1. QTP “Uninstall was not completed” problem I came across this problem while installing QTP 9.5 earlier...
  2. HP Software Trial License Periods HP software tools all have have different trial licensing periods....
  3. Integrating QTP with Terminal Emulators According to the system documentation, QuickTest Professional supports a number...
  4. Using the QuickTest Professional “commuter” license If you’re like me and want to use QuickTest Pro...


Bookmark using any bookmark manager!

 

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response to “How to make QTP “analog mode” steps more reliable”

  1. Ken Palmer Says:

    This looked promising. Can’t get it to work in QTP 10/ XP /IE 7. Can’t find object “Window” [of class "Window"]. Rats.

Leave a Reply