QTP – How to use the FireEvent method when a click does not work

Automation Guild Online Conference Top ad

How to use the FireEvent method

While using QTP’s click method on a search WebElement earlier today, I had an issue with a 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 occurs), don’t give up – and be sure to try the FireEvent method.

What is the FireEvent Description:

The FireEvent method is designed to trigger events in an application.

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!

Know FireEvent Issue

If your trying to use the FireEvent’s dblclick option on a WebElement but its not working against Chrome or FireFox  check out

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

praveen - September 14, 2011

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

    Joe Colantonio - November 23, 2011

    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.

Sim - February 16, 2012

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.

    Joe Colantonio - February 20, 2012

    Sim » Hi-Have you tried using the webtable(“M”).GetCellData(r,c) method?

Sim - February 29, 2012

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.

Poonam - April 17, 2012

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

    Joe Colantonio - April 17, 2012

    Poonam » Hi-When you spy on the object does the Outertext property have a value?

      Nikhil - January 14, 2015

      Hi Joe,

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

Poonam - April 18, 2012

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

Poonam - April 18, 2012

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

Pratibha Pawar - May 30, 2012

Thank you so much for the suggestion. the code is working accordingly using FireEvent on webelement.

    Joe Colantonio - May 31, 2012

    Pratibha Pawar » Cool!

Jagadeesh - September 17, 2012

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.

    Lacy McClain - April 18, 2013

    I have the same question.

Ganesh - October 26, 2012

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.

srikanth - February 27, 2013

HI, How to Write a code for to select one child link of floating Menu( if menu have multiple Links)

    Joe Colantonio - March 1, 2013

    srikanth » Any chance you could give me an example of a floating menu? When you spy on it what is it’s nativeclass?

vijay - March 21, 2013

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

Baskar - March 26, 2013

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

    Joe Colantonio - March 26, 2013

    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.

Nikhil - April 7, 2013

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?

Aminul - April 19, 2013

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

Azeem - May 3, 2013

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”)

    rosanara - July 17, 2013

    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

Bibhu - June 23, 2013

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.

Nils - June 28, 2013

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

    Nils - June 28, 2013

    correction i meant icon that i have to click is a webelement which is present in the last column of row.

    janmejay kumar - August 20, 2014

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

prema - July 18, 2013

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

Meghna - July 30, 2013

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 settings.no use..
Your reply is highly appreciated

Vamc - October 16, 2013

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 :)

preetu - January 31, 2014

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

Kalai - April 2, 2014


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

Kumar - September 6, 2014

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

    Joe Colantonio - September 16, 2014

    If you create a quick record script does it recognize and dbl click on the java table? Is this a custom control? Worst case scenario can you use the insight record option in UFT

Kumar - September 6, 2014

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

Safi - January 16, 2015

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”


[BLOCKED BY STBV] 3 ways to use keyboard input in QuickTest Professional: Type, SendKeys and Device Replay | Joe Colantonio - Test Automation Selenium-UFT-QTP-SoapUI-ALM_LoadRunner and More! - April 4, 2015

[…] Also Occasionally you may have issues with event not being  triggered when using one of these methods. In that case check out my post of how to use the FireEvent method. […]

Jowel Fadel - June 1, 2015

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.

srikanth - July 21, 2015

Thanks man, this is usefull.

Click here to add a comment

Leave a comment: