Awesum Stuff

How to Handle “Dialogs” in Firefox (using QTP)

Sometimes QTP doesn’t recognize a dialog in Firefox. These types of Dialogs are not caught by the Object Spy and it seems difficult to handle it if its appearing somewhere in your application. Following code helped me get out of this situation :-

dialogText=Browser(“creation time:=0″).GetDialogText

If Instr(dialogText,”Text that you are looking for”) Then
Browser(“creation time:=0”).HandleDialog micOK
Else
Print “Unknown Dialog Found”
End If

The above code will click on the OK button if the “Text that you are looking for” (this can be any user defined value) matches the Text that is displayed on the Dialog.

Cheers !

Advertisements

3 replies »

    • Hi Thuong,

      The Handle Dialog method supports only two buttons – OK and Cancel. What kind of button are you working with ? Can you give me the url where you are trying to do this ?

      Thanks,
      Harshit

      • Sr for the delay. I didn’t see your comment 2 days ago.
        I can not give you the url. I have 2 problems:
        1. On modal popup, QTP doesn’t identify the popup. But I can get message from popup by function HandleDialog GetDialogText and click OK, Cancel button. I need to check existence of OK and Cancel buttons before clicking on them.
        2. If buttons are “Leave Page” and “Stay on Page”, can I check they are existing? How can I click on them (without sendkey)?

        I really appreciate your kindly reply 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s