Micro Focus QTP (UFT) Forums
IE Dialog Box, Print - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: IE Dialog Box, Print (/Thread-IE-Dialog-Box-Print)



IE Dialog Box, Print - XeNoMoRpH - 06-29-2009

I have a website with an input button named Print. It opens a page which then fires off a Print dialog box via javascript using window.print();. My problem is I have not been able to automatically close it. Does anyone have any experience with this? My code is the following:

Code:
Browser("title:=(.*)Print(.*)").Dialog("regexpwndtitle:=Print").WinButton("text:=Cancel").Click

It says
Quote:Cannot find the "[WinButton]" object's parent "[Dialog]" (class Dialog). Verify that parent properties match an object currently displayed in your application.

I have a Wait command before it that waits for 2 seconds. I'll probably end up changing it to 5 to see if that helps.


RE: IE Dialog Box, Print - Anshoo Arora - 06-30-2009

Hello,

Please see if the following helps:

Code:
With Dialog( "micclass:=Dialog" )
    If .Exist( 5 ) Then
        .WinButton( "text:=Cancel" ).Click
    End If
End With



RE: IE Dialog Box, Print - XeNoMoRpH - 06-30-2009

Awesome. That did the trick!