1
votes

I'm attempting to download a file from my QTP script. I want to record my action of clicking on 'Save' or 'Cancel' button but I'm getting error that object is not visible.

I check Object Repository and see File Download object with following description properties:

text: File Download
nativeclass: #32770
is owned window: True
is child window: False

...and no ordinal identifier.

Here is my script:

Browser("Browser").Page("Page").WebEdit("meetingid").Set "982"
Browser("Browser").Page("Page").WebEdit("docid").Set "22"
Browser("Browser").Page("Page").WebButton("Submit").Click
Browser("Browser").Dialog("File Download").WinButton("Cancel").Click

I get this error:

Object not visible
>Line (4): "Browser("Browser").Dialog("File Download").WinButton("Cancel").Click".

What do I need to do to make it visible? I've tried adding the 'visible' property under Tools - Object Identification - File Dialog. But when I do that I start getting run-time errors on all the objects that have non-unique identifiers, i.e. elements with the same 'name' value that appear more than once.

Is there something I'm missing here, or a better way to do this?

Thank you for any help.

2
i have a 2-monitor setup. If I run the browser in the same window as QTP then it works. That is very, very strange. - fumeng
A few questions. 1) What version of QTP are you using? 2) You say you have two monitors. a) Is the primary monitor to the right or to the left. b) which monitor is QTP in. - Motti
I'm using QTP 10. The primary monitor is to the left and QTP is running in the primary monitor. I had the browser I was testing in the secondary monitor. - fumeng
AFAIK this has been resolved in QTP 11 - Motti
AFAIK QTP 11 still has the "undocumented" requirement of the AUT running on the primary display. - TheBlastOne

2 Answers

1
votes

A better way to handle this would be by not using specific objects at all(Since you have to run it in multiple machines). Use key strokes to simulate 'Save', and copy the file to the desired location from the default location using FilesystemObject.

1
votes

It appears that having my browser that I was testing in my secondary monitor (I have a 2-monitor setup) and QTP running in the primary monitor caused this problem. As soon as I moved the browser to the same monitor QTP was running in I had no more problems.