QTP Difference in Behavior When Running Against IE vs Firefox

QTP/UFT Published on:

IE vs. Firefox

If you've done any type of web development for browsers in the past, I'm sure I don't have to tell you how frustrating the differences between browser types can be. Unfortunately, having to automate different browser types is no exception.

With the release of patch QTPWEB_00090, QTPWEB_00092 , and QTPWEB_00100, QuickTest Professional now supports testing web applications in Firefox browsers. There are differences, however, in the ways in which QTP interacts with the two browsers that you should be aware of.

WebButton Differences

When recording against IE on a WebButton, the default “Type” property value is Button. Against Firefox, however, the default value is Submit. To avoid issues, be sure not to use the Type property in your object repository or programmatic description to identify a webbutton test object.

DOM Differences

The Document Object Model (DOM) used for Internet Explorer is different than the one used by FireFox. That means that if you're writing scripts that need to interact directly with DOM statements, you have to bake in logic to handle both. To find out more, check out:

Dialog Boxes

That's right – and how annoying is this? – but IE and Firefox use different dialogs. For example, Firefox 3.x and below will show a security dialog with a different format than IE:

What's even crazier is that the newer versions of Firefox's dialogs are also different from older versions of Firefox. Luckily for new Firefox releases, however, QTP has two new Firefox dialog-related methods: HandleDialog and GetDialogText.

HandleDialog and GetDialogText

Both methods can be accessed from the Browser object and enable you to perform actions against browser dialog boxes that were opened from HTML content:

  • HandleDialog – This method clicks a button on a browser dialog box such as an alert, confirmation or prompt:
    • Browser(“Browser”).HandleDialog micOK
  • GetDialogText – This method retrieves the text displayed in a browser dialog box:
    • browserText = Browser(“Browser”).GetDialogText

(These methods only work with Mozilla FireFox 4 or higher, and you'll need to have the latest FireFox patches installed.)

Recovery scenarios

Because of the difference in standard dialog boxes described above, if you're using pop-up recovery scenarios that use the Click button against Dialogs, you're basically screwed. Recovery operations that were built for Microsoft Internet Explorer will not work for Firefox!

Firefox menus and sidebars

QuickTest Pro does not support Firefox menus or sidebars. The only toolbar buttons it supports are the following:

  • Home
  • Refresh
  • Back
  • Forward
  • Stop

Known QTP 10 FireFox limitations

QTP 10's recording feature is not supported against Firefox.

The Object property is not supported in QTP 10 and older versions.

As far as possible problems with QTP or Firefox go, the preceding are all that come to mind at present.

If you know of or experience any other issues, please let me know!


16 responses to “QTP Difference in Behavior When Running Against IE vs Firefox”

  1. How to use script for check exist dialog box on Firefox browser before use GetDialogText command

    Thank you

    • juckrid » Hi – your could create a function that checks for dialog text if it find it do something. For example:

      Function Dialog_Exist()
      ‘Next sentence will handle QTP error message
      On error resume next
      ‘Save normal reporter value.
      x = Reporter.Filter
      ‘Instruct QTP to avoid reporting any error to the Test Results
      Reporter.Filter =3
      ‘If the following sentence raises the error, then there is not a Dialog displayed.
      doesExist = Browser(“YourBrowser”).GetDialogText
      ‘Validate the error number. Zero means that there are no errors
      If err.number <> 0 Then
      Dialog_Exist = false
      Dialog_Exist = true
      End If
      ‘Set Reporter.Filter to default value
      Reporter.Filter = x
      ‘Instruct QTP to show error messages if necessary (as it does normally)
      On error goto 0
      End Function

      If Browser(“YourBrowser”).DialogExist Then
      ‘Add your dialog code
      End If

  2. Joe,

    Thanks a ton for writing about ‘HandleDialog’, learning about that was really helpful. Apparently I missed that in one of the readmes for all these patches and it’s certainly not in the QTP Help file. One thing to note is that ‘HandleDialog’ does not seem to work (for me) on the dialog that pops up when you click on a link to a PDF file. Not sure why, but no matter what I try, I get a Runtime error that simply says “The operation cannot be performed”. QTP sees the dialog, can Activate it, but can’t use the HandleDialog method for whatever reason. For now, until I can figure out why HandleDialog isn’t working, I’ll just have to use .Type micReturn and assume that the OK button will always be the default.

    • Joel » Hi Joel – not sure why this is happening. I will try to reproduce on my machine this week. I’ll let you know what I find. What version of FireFox are you using and what OS? Cheers~Joe

      • Hey Joe, thanks for responding and sorry for my delayed response. I’m using FireFox 12, latest version of QTP with all applicable patches and Win 7 64 bit. Anything you find would be awesome and if I come up with anything I’ll make sure to come back and update. Thanks!

  3. Hi Joe, may I know on what browsers QTP supports recording feature? do we have any table with the list of browsers supporting recording/run features.

    Thank you

  4. Hi Joe and Joel,

    Do you Guys found any resolution for above issue mentioned by joel, me too facing the same issue and have been trying to find out work around .. but not yet succeeded.. it would be great help if you share the resolution for this..

    Thanks a ton!! in advance.

  5. Hello Joe,

    I have a problem with QTP11, when I start to record and opens the website, not visible option menu of the page, this only when I’m recording, but I open the page without qtp opens normally I have java installed addins and web, IE8, Win XP.

    Hopefully you can help me.


    • adrian » Hi – Sorry not sure I understand your issue. What is the behavior? You are trying to record against a web site and the option menu page is not visible – is option menu the name of a page in your application?

  6. Hi,

    1) I have installed Firefox 12.
    2) I have installed patches QTPWEB_00090, QTPWEB_00092 and QTPWEB_00100.
    3) I registered firefox to QTP11.
    4) In firefox extensions the QTP plugin got enabled.
    5) I am able to record and run scripts on Firefox.
    6) However, when I am running my existing scripts which is a windows application, its not recognizing the objects.
    7)Before installation of Firefox patches it used to run well.

    When I uninstalled the patches it is recgnizing the windows app again.

    Please adive.

  7. Hi Joe,

    Can you share a sample on how you’ll code your Recovery Scenario to handle both IE and Firefox?

    Thank you very much!

    • Hi Gilber – Because of the difference in standard dialog boxes described above, if you’re using pop-up recovery scenarios that use the Click button against Dialogs, you’re basically screwed. Recovery operations that were built for Microsoft Internet Explorer will not work for Firefox :(

  8. Hi Joe,

    I have QTP 11.0 and Firefox 17.0.4 installed. I am able to identify the objects successfully. But the problem I am facing is I am not getting the methods HandleDialog and GetDialogText under Browser(…).

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.