1
votes

We are automating a web application using UFT/QTP. The issue is that UFT works only on those web objects which are seen in browser window part. If any object/element is at the bottom of the page and require scroll down in window to be seen. UFT is not able to work on those objects. We have written code to page down to work on those objects. It works fine. But sometimes when page is very lengthy and we don't know at what position that object will be like in middle of the page, or far bottom of the page etc. In that case, only page down does not work. Is there any way that we can make the object visible on the basis of object properties? That means we can bring object in front of the window.

3

3 Answers

0
votes

If your scrolling pageup or pagedown code is already working, why don't you use a loop...

Set obj = Browser(..).page(..).Link(..) ' use your object

While obj.getROProperty("visible") = False
    'Scroll code
Wend
0
votes

UFT doesn't depend on whether the object is in view or not. If an object is scrolled out of view UFT will automatically scroll it into view before performing any action upon it (e.g. Click).

The behaviour you're describing may be caused by the fact that the web site dynamically adds objects to the DOM when the page is scrolled. If this is the case then UFT has no way to know what will cause the object to be added to the DOM and you have to scroll for it they you've been doing.

Sorry I couldn't bring better news :(

0
votes

I had once faced a similar issue. For me, changing the Replaytype setting to mouse events worked. Try changing the ReplayType to Mouse events just before performing any operation(say clicking the object) as shown below:

Settings.WebPackage("ReplayType") = 2    'Changes to mouse/device events mode
'Perform the Click Operation here
Settings.WebPackage("ReplayType") = 1     'Change back to Browser events mode

Additional information on ReplayType:

This setting allows us to change the way mouse operations should happen on AUT. It can be either browser events or mouse event. Browser event is similar to DOM events using the Browser methods, wheras Mouse event simulate the actual user action either from keyboard or mouse. For example if you click on a button when ReplayType is Mouse, you will notice that mouse pointer moves to the location of button and fires the event, but in case of browser event it doesn’t.

Values of replaytype can be:

1 – Event

2 – Mouse

By default it is set to Event i.e 1