QTP Firefox Dialog Error: The Operation Cannot be Performed

QTP/UFT Published on:
patch update

So. You've got all the correct Firefox patches installed for QuickTest Professional and you're rockin' some scripts. Life is good…until you have to start dealing with Firefox dialog boxes.

Sure — QTP has some cool Firefox dialog methods (think HandleDialog and GetDialogText) but they sometimes return the error “The operation cannot be performed.” Are you wondering why this is happening? Well, as it turns out, it's actually a known issue.

Why does this dialog error occur?

The two Firefox dialog box methods HandleDialog and GetDialogText only work against browser dialog boxes like alerts, confirmation and prompt dialogs that were opened from HTML content in Firefox.

Any window dialog boxes that QTP recognizes as Dialog objects will generate a “The operation cannot be performed” when you try to use the Firefox dialog methods against them.

Workaround for QTP Dialog Issue

You might be able to work around this issue with window dialogs displayed by the browser by using the Type method. The Type method for a Dialog object in QTP has a bunch of actions that can be used to select the desired option from the dialog box.

For example, you can Type the return key to select a default option in a dialog:

Browser("Joe").Dialog("Joe").Type micReturn

You can also string together a bunch of Type actions to create the desired functionality. For example, you could use the Type action tab to continue tabbing until you highlight the desired option:

Browser("Joe").Dialog("Joe").Type micTab + micTab + micTab + micReturn

Table of Valid QTP Dialog Type Actions

Below is a table of all the valid Type actions that you can use against a Dialog object:

Constant Action
micCtrlDwn Presses the Ctrl key.
micCtrlUp Releases the Ctrl key.
micLCtrlDwn Presses the left Ctrl key.
micLCtrlUp Releases the left Ctrl key.
micRCtrlDwn Presses the right Ctrl key.
micRCtrlUp Releases the right Ctrl key.
micAltDwn Presses the Alt key.
micAltUp Releases the Alt key.
micLAltDwn Presses the left Alt key.
micLAltUp Releases the left Alt key.
micRAltDwn Presses the right Alt key.
micRAltUp Releases the right Alt key.
micShiftDwn Presses the Shift key.
micShiftUp Releases the Shift key.
micLShiftDwn Presses the left Shift key.
micLShiftUp Releases the left Shift key.
micRShiftDwn Presses the right Shift key
micRShiftUp Releases the right Shift key.
micIns Presses the Insert key.
micDel Presses the Delete key.
micHome Presses the Home key.
micEnd Presses the End key.
micPgUp Presses the Page Up key.
micPgDwn Presses the Page Down key.
micUp Presses the Up arrow key.
micDwn Presses the Down arrow key.
micLeft Presses the Left arrow key.
micRight Presses the Right arrow key.
micEsc Presses the Esc key.
micBack Presses the Backspace key.
micReturn Presses the Return key.
micTab Presses the Tab key.
micBreak Presses the Break key.
micPause Presses the Pause key.
micPrintScr Presses the Print Screen key.
micWinLogoDwn Presses the Windows Logo key.
micWinLogoUp Releases the Windows Logo key.
micLWinLogoDwn Presses the left Windows Logo key.
micLWinLogoUp Releases the left Windows Logo key.
micRWinLogoDwn Presses the right Windows Logo key.
micRWinLogoUp Releases the right Windows Logo key.
micAppKey Presses the Application key.
micF1 Presses the F1 key.
micF2 Presses the F2 key.
micF3 Presses the F3 key.
micF4 Presses the F4 key.
micF5 Presses the F5 key.
micF6 Presses the F6 key.
micF7 Presses the F7 key.
micF8 Presses the F8 key.
micF9 Presses the F9 key.
micF10 Presses the F10 key.
micF11 Presses the F11 key.
micF12 Presses the F12 key.
micNumLockOn Turns on the Num Lock.
micCapsLockOn Turns on the Caps Lock.
micScrollOn Turns on the Scroll Lock.
micNumLockOff Turns off the Num Lock.
micCapsLockOff Turns off the Caps Lock.
micScrollOff Turns off the Scroll Lock.


Hey Joe, this sucks!

Look — I understand it's not optimal, but I've seen this approach work quite well for this Firefox Dialog issue, so give it a try!

2 responses to “QTP Firefox Dialog Error: The Operation Cannot be Performed”

  1. Hi Joe,

    i am getting Error as “Object doesn’t support this property or method: ‘Window(…).HandleDialog'”.

    Firefox version: 17.0.4
    QTP 11.0

    I am not getting the methods ‘HandleDialog and GetDialogText’ under Window(…). options.

    I am successfully able to identify other objects in firefox.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

patch update