QTP Firefox Dialog Error: The Operation Cannot be Performed

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:

ConstantAction
micCtrlDwnPresses the Ctrl key.
micCtrlUpReleases the Ctrl key.
micLCtrlDwnPresses the left Ctrl key.
micLCtrlUpReleases the left Ctrl key.
micRCtrlDwnPresses the right Ctrl key.
micRCtrlUpReleases the right Ctrl key.
micAltDwnPresses the Alt key.
micAltUpReleases the Alt key.
micLAltDwnPresses the left Alt key.
micLAltUpReleases the left Alt key.
micRAltDwnPresses the right Alt key.
micRAltUpReleases the right Alt key.
micShiftDwnPresses the Shift key.
micShiftUpReleases the Shift key.
micLShiftDwnPresses the left Shift key.
micLShiftUpReleases the left Shift key.
micRShiftDwnPresses the right Shift key
micRShiftUpReleases the right Shift key.
micInsPresses the Insert key.
micDelPresses the Delete key.
micHomePresses the Home key.
micEndPresses the End key.
micPgUpPresses the Page Up key.
micPgDwnPresses the Page Down key.
micUpPresses the Up arrow key.
micDwnPresses the Down arrow key.
micLeftPresses the Left arrow key.
micRightPresses the Right arrow key.
micEscPresses the Esc key.
micBackPresses the Backspace key.
micReturnPresses the Return key.
micTabPresses the Tab key.
micBreakPresses the Break key.
micPausePresses the Pause key.
micPrintScrPresses the Print Screen key.
micWinLogoDwnPresses the Windows Logo key.
micWinLogoUpReleases the Windows Logo key.
micLWinLogoDwnPresses the left Windows Logo key.
micLWinLogoUpReleases the left Windows Logo key.
micRWinLogoDwnPresses the right Windows Logo key.
micRWinLogoUpReleases the right Windows Logo key.
micAppKeyPresses the Application key.
micF1Presses the F1 key.
micF2Presses the F2 key.
micF3Presses the F3 key.
micF4Presses the F4 key.
micF5Presses the F5 key.
micF6Presses the F6 key.
micF7Presses the F7 key.
micF8Presses the F8 key.
micF9Presses the F9 key.
micF10Presses the F10 key.
micF11Presses the F11 key.
micF12Presses the F12 key.
micNumLockOnTurns on the Num Lock.
micCapsLockOnTurns on the Caps Lock.
micScrollOnTurns on the Scroll Lock.
micNumLockOffTurns off the Num Lock.
micCapsLockOffTurns off the Caps Lock.
micScrollOffTurns 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!

2comments
Manuel - December 13, 2012

Once again Thanks a lot Joe!

Manuel Vazquez

Reply
Amar Sharma - October 10, 2013

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.

Reply
Click here to add a comment

Leave a comment: