How to Use the FireEvent QTP Method When a Click Does Not Work

Automation Testing Published on:

There are instances where clicking on an object within your application doesn't work the way you expect. Maybe the web element you're trying to click on is hidden behind another object. Or, perhaps it's just not visible on the page. 

As you know, it's always frustrating. But, in such cases, you can use the FireEvent QTP method to interact with the element.

So, don't let a faulty click get in the way of your testing. Read on for more details!


Why Won't the FireEvent Work?
The FireEvent Description
QTP FireEvent Syntax
Valid FireEvent Events
How to Use the FireEvent Video Example
Know FireEvent Issue

Why Won't the FireEvent Work?

While using QTP’s click method on a search WebElement earlier today, I had an issue with the WebTable’s populate event not being triggered as it should have. If you ever experience a similar problem with your application (not performing an expected action after a certain event), don’t give up – and try the FireEvent method.

FYI if you're having issues with quick test professional or unified functional test and it's a custom control, you might want to check out my post How to Build Your Own Custom Control Code.

The FireEvent Description

The FireEvent method is designed to trigger events in an application. Besides that, you can use it when a click does not work. It is also important to note that the FireEvent method will work differently depending on your browser.

Get Free Courses

QTP FireEvent Syntax

The Syntax for the FireEvent is:

yourObject.FireEvent EventName,[x-optional],[y-optional],[BUTTON-optional]

Valid FireEvent Events

The events available when using the FireEvents method are:

  • onchange
  • onclick
  • ondblclick
  • onblur
  • onfocus
  • onmousedown
  • onmouseup
  • onmouseover
  • onmouseout
  • onsubmit
  • onreset
  • onpropertychange

How to Use the FireEvent Video Example

Let’s take a look at the FireEvent in action in a real-world example:

The click method below was not working:

Set mainPath = browser("CB").Page("CB")

…but using the FireEvent did work:

mainPath.WebElement("Search").FireEvent "ondblclick"

Drop me a line and let me know if you find this tip helpful!

Get in touch with us

Know FireEvent Issue

If you're trying to use the FireEvent’s dblclick option on a WebElement, but it's not working against Chrome or Firefox, check out:

QTP – Fix for FireEvent Issue in Google Chrome and Firefox Browsers

Leave a Reply

Your email address will not be published.

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

  1. i have tool tip object when i am taking the mouse to that icon it is giving the value but when i am using the spy it is not having values and i have used the following code

    Browser(“Product Zone – FXSpot”).Page(“Product Zone – FXSpot”).WebElement(“WebElement”).FireEvent”onmouseover”
    wait 1
    ToolTip = Window(“nativeclass:=tooltips_class32”).GetROProperty(“alt”)
    msgbox ToolTip

    1. praveen » Hi sorry for the late reply – did you figure this our yet? I have the same code that works excepts I use the GetRoProperty(“text”) property instead of alt. I also use a .Mouse move with the tooltips coordinates.

  2. I am Getting following error –
    Failed to run the test due to an unknown error.
    For line-
    Line (17): “Browser(“Test Home”).Page(“Add Home Standard”).Frame(DatePicker).webtable(“M”).Link(“name:=” + “&16″).Click”

    I am using QTP 10.0 and trying to select a date from the calendar on a sharepoint based application.
    Although, it opens the calendar and points to the date as 16 Feb 2012, but is not able to select and capture the date in the desired box.
    Please let me know the correct syntax for capturing the DATE from the calendar.

  3. Hi Joe.
    I’ve updated the code for the date picker line for the calendar now :

    Browser(“ABC Home”).Page(“Add Standard”).Image(“Select a date from the”).Click 10,5
    ‘Browser(“ABC Home”).Page(“Add Standard”).Frame(“DatePicker”).webtable(“M”).webelement(“Date”).FireEvent(“onmouseclick”)

    Browser(“ABC Home”).Page(“Add Standard”).Image(“Select a date from the”).Click 10,5
    Browser(“ABC Home”).Page(“Add Standard”).Frame(“Frame”).webtable(“M”).webelement(“Date”).FireEvent(“onmouseclick”)

    and it still shows –

    The “Frame” object was not found in the Object Repository.

    Check the Object Repository to confirm that the object exists or to find the correct name for the object.
    Check the Object Repository to confirm that the object exists or to find the correct name for the object.
    Line (16): “Browser(“POLO Home”).Page(“Add Policy Standard”).Frame(“Frame”).webtable(“M”).webelement(“Date”).FireEvent(“onmouseclick”)”.

    Although, it opens the Calendar in that frame and highlights today’s date,
    but is not able to selects the date and fill the required field fro the date by picking from the calendar.

    Please suggest.

  4. Hi Joe,
    Ur video is very helpful, but can u please tell me what to do if GetROProperty(“Outertext”) is blank. Does that mean the object is not recognized? & how to solve that issue?

    waiting for ur suggestion. Thanks

      1. Hi Joe,

        I need to use QTP for sharepoint application automation. Is it possible?
        Can you please suggest your opinion on this.

  5. Hi Joe,
    Thanks for the reply, i will give u some more details about the same issue.
    1) Application used is .net
    2) There is noOutertext property seen through object spy
    3) I could record the code properly, when executed in Debug mode the data is getting added in the table (something similar like ur video shown above about ‘Search’ button and data
    population). But the issue comes when i RUN the script. The button is getting clicked properly but the data which should be added in a table after the click, is not getting added.

    4)SwfWindow(“TOM”).SwfWindow(“SwfWindow”).SwfWindow(“TOM_Amount Details”).SwfObject(“btnSave”).Click 83,19
    Other method tried is
    x= SwfWindow(“TOM”).SwfWindow(“SwfWindow”).SwfWindow(“TOM_Amount Details”).SwfObject(“btnSave”).GetROProperty(“enabled”)
    msgbox x ((Here x gives proper value TRUE))
    SwfWindow(“TOM”).SwfWindow(“SwfWindow”).SwfWindow(“TOM_Amount Details”).SwfObject(“btnSave”).Click 83,19

    Click is also happening, but no data is added.
    Waiting for ur reply

  6. Hi Again,

    some more info :
    Tried using FireEvent “onclick” the follwing way,
    SwfWindow(“TOM”).SwfWindow(“SwfWindow”).SwfWindow(“TOM_Amount Details”).SwfObject(“btnSave”).FireEvent “onclick”

    But no luck, it gave me Exception Occured error.
    Please help

  7. Hi ,

    Please see the below script,which I recorded.
    Browser(“Welcome to the website”).Page(“Date”).Frame(“ContentIFrame”).Image(“img_calendar”).Click
    Browser(“Welcome to the website”).Page(“Date”).Frame(“ContentIFrame”).Link(“17”).Click

    In the above script , I need to select current date for each run.Can anyone provide me suggesstion , how to get current date, as the date is displayed as link.I am confused little bit
    Plz give it in Descriptive programming

    Note:1.Only able to select the date.Not able to enter manually.

  8. Hi Joe,

    Mine is similar to the video. Here I have weblist & upon selection data should populate in webtable. I tried below but does not work.

    Browser(B).Page(P).WebList(wl).Object.FireEvent “onchange”
    Browser(B).Page(P).WebList(wl).Select data
    Browser(B).Page(P).WebList(wl).Object.FireEvent “onchange”

    I tried with & without .object.FireEvent. Pls help to resolve this.

  9. hi joe,

    i need to validate excel sheet icon and the color of the insert work paper which will be in navaigatoin bar in application which i am automating with QTP , silver-light add-in how to do this any suggestions from your end would be helpful for me

  10. Hi Joe,
    earlier i have used qtp 11 and capture the object as swfedit for dotnet 3.5 version application. Now i have upgraded to UFT 11.5, now the same object is recognized as swfobject. could you please let me know if you have solution for this

    1. Baskar » Not sure why this is happening.
      Dumb question – are you sure the .NET add-in is selected when you start UFT?

      What version of UFT do you have installed? HP did release a critical service pack 11.51 for UFT (UFT_00001) that they recommend everyone install. If you don’t have the SP I would start there.

      Also I double checked HP’s KB and did not find any known issues with UFT and .net 3.5. You might want to also contact HP support and check to see if there are any known issue or hot fixes that will resolve this for you.

  11. Hi Joe,

    I wanted to hover my mouse on a link in Nav bar, as after hovering there are many links and I need to get child objects from that.. How do I do?

  12. I am trying to Click on 100 links putting them through a For Loop but it is not working after flirt round when it goes back for second round it throws a General error . please help

  13. I am trying to capture the tooltip of Weblist which is placed on a table. the below code is not working consistently. Please suggest some alternative. please find the code
    Set pS = Browser(“Browser”).Page(“page”).Frame(“frame”).WebTable(“WebTable”).ChildItem(2,5, “WebList”, 0)
    wait 1
    actualErrorText= Window(“nativeclass:=tooltips_class32”).GetROProperty(“text”)

    1. WHy u people using Window class in the web based application that is genuine it fire error better use fire event and pass the appropriate event name ,,sorry for too late replay

  14. Hi Joe,
    I have appreciate your replay on testing question ,
    Please help me script how to select a folder and right click then verify cut button is disable ,where two cut items is present menu.

  15. Hi Joe,

    i am trying to click a webelement which in the last row of a table. Each row of this table is a webtable itself and not a row and i need to be able to click on specific “webelement”. I tried firevent onclick and ondblclick but its doesnt work.

    1) This code based on index value works but i dont want to use index value.
    i = 0
    Browser(“Admin”).Page(“SearchMain”).WebElement(“class:= ux-icon-action”, “html tag:= DIV”, “index = i”).Click

    2) None of the below option works
    Set Icon1 = Browser(“Admin”).Page(“SearchMain”).WebTable(“Table-2″).ChildItem(1,16,”WebElement”,0)
    Icon1.fireevent “ondblclick”
    Icon1.fireevent “onclick”

    Could you help me with this. thanks

    1. U use Childitm(row,column,”micclass’,index) to find the specific data which is present in webtable. thankx

  16. hi friends,
    I am trying to click on webelement but its not happening with below code,,
    Browser().page().WebElement(“”).FireEvent “ondblclick”
    Browser().page().WebElement(“”).FireEvent “onclick”
    and i changed replay type to “mouse” but still clicking is not happening…can u please suggest me
    Thanks in advance

  17. Hi Joe,
    Mine is a pega application.In this i have a screen where i have to double click and select the web element from the list and it gets autpopulated in the fields.I ahve tried using the firevent and web conf use..
    Your reply is highly appreciated

  18. Hi Joe,
    By seeing the above comments in the discussion, I could say that there is no solution provided to Mr.Sim’s Date Picker Problem.
    I too have the same problem, I have to select the date using Day(Now) func. which would be varying time to time,
    Have tried all the above methods including Fireevents, Hmmmm No Luck, Could You help me with the same??
    My Script’s as Below:
    Dim a,b,c
    Public Function clickelement(a,b,c) Browser(a).Page(b).WebElement(c).Click/FireEvent(“onmouseclick”)/FireEvent “onclick”
    End Function
    clickelement “Home”, “Book Appointment “, day(Now)

    W8ing for a solution :)

  19. Hi I am working with online AAA fuel cost calculator and somehow just not able to create code to select “start city” from the dropdown weblist. I did a record and reran the script. It fails to select an item from the weblist saying it can’t ID the object “DDStartCity” of class (“Weblist”). I then tried Add object to local and created a script but again same error . I tried the Fireevent mtd u gave again same error. I did a msgbox to chk if the correct value is getting picked through Getitem . it does pick the correct value but it doesn’t select it from the weblist. PLS HELP in coding this

  20. Hi,

    I am trying to click webtable link. I have tried most of the options, but no luck. Pls some help me on this

    Webtable link highlights correctly but its not clickable

    Here is my code

    Set oWebTable = Browser(“”).Page(“”).WebTable(“Class Name:=WebTable”, “column names:=Farm Number;Tract Number;Scenario Description;Program Year;Offer Status;Offered Acres;State/County Physical Location;”,”html tag:=TABLE”,”name:=View”)

    linkcount = oWebTable.ChildItemCount(3,9, “Link”)

    If oWebTable.Exist Then
    linkname =oWebTable.ChildItem(3,9, “Link”,0).GetROProperty(“text”)
    urlname =oWebTable.ChildItem(3,9, “Link”,0).GetROProperty(“url”)
    oWebTable.ChildItem(3, 9, “Link”, 0).Highlight
    oWebTable.ChildItem(3, 9, “Link”, 0).Click
    Browser(“”).Page().WebTable(“Class Name:=WebTable”, “column names:=Farm Number;Tract Number;Scenario Description;Program Year;Offer Status;Offered Acres;State/County Physical Location;”,”html tag:=TABLE”,”name:=View”).Link(“Class Name:=Link”,”html tag:=A”,”name:=Submit To COC”, “url:=”&urls).FireEvent “onclick”

    oWebTable.ChildItem(5, 9, “Link”, 0).FireEvent “micMousePress”

    End If

  21. I want to double click on a row in a JAVATABLE I tried below , but failed. Please help me.

    1> Using mercury device replay
    it’s able to click the row,but not able to double click

    2> Using fireevent “ondblclick”
    it say operation can not be performed.

    now I will write the code
    1> set mouse= CreateObject(“Mercury.DeviceReplay”)
    mouse.mousemove x,y ‘ fine
    mouse.mouseclick x,y,button’ fine
    mouse.mousedblClick x,y,button ‘does not work ! WHY??/

    2> JavaWindow().JavaInternalFrame().JavaTable().fireEvent “ondblclick”
    gives error operation can not supported..

    Pls help me

  22. JavaWindow().JavaInternalFrame().JavaTable(). doubleClickCell 3,3

    It says
    Error Message- Operation can not be performed. However when I do .(dot) at javatable I can see doubleClickCell method in the intellisence.
    UFT 11.53

  23. Hi Joe,


    I have the below code. It supposed to double click “test” folder but it just select the folder instead. How can I double click the test folder so I can select a file inside the test folder?

    Dialog(“Save current report in”).WinObject(“Items View”).WinList(“Items View”).Select “test”


  24. Works great, many thanks for the help. We have a Win7 machine with UFT 11.5 and IE v8, and it couldn’t invoke a certain image link using the “click” method, though was fine when invoking other image links in the same way. We didn’t see this problem with another machine running IE v10.

  25. Hi, I just wanted to ask if there is a way to get the HTML Element x and y position/coordinates using VBA

    for each td in ie.document.getelementsbytagname(“td”)
    if td.innertext = “ThisElement” then
    x = elem.positionx (just a sample)
    y = elem.positiony (just a sample)
    end if
    next td

  26. I am working on of the web application. However I am unable to click in link even after able to highlight successfully. Click method is not working on this object. Please assist.

    Code Used:

    Browser(“Brwoser”).Page(“Page”).WebElement(“WebelemenProperties”).Highlight ””’ Im able to highlight

    Browser(“Brwoser”).Page(“Page”).WebElement(“WebelemenProperties”).Click ”’ Click method is not working

    Browser(“Brwoser”).Page(“Page”).WebElement(“WebelemenProperties”).FireEvent “onClick” ”’ This also not working

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Latest Automation Trends: Top 13 Predictions for 2023

Posted on 01/04/2023

Welcome to my annual Latest Automation Trends: Top 13 Predictions for 2023 article. ...

Chrome Selenium Driver in Visual Studio C#

Posted on 12/21/2022

I'm sure you've all heard of Selenium by now. It's a popular tool ...

15 Reasons Why You Should (or shouldn’t) Automate a Test

Posted on 12/20/2022

Just because you can automate tests doesn’t necessarily mean that you should. In ...