Thursday, November 10, 2011

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

Overview: 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. Description: The FireEvent method is designed to trigger events in an application. Syntax: The Syntax for the FireEvent is: yourObject.FireEvent EventName,[x-optional],[y-optional],[BUTTON-optional] Valid Events: The events available when using the FireEvents method are:
  • onchange
  • onclick
  • ondblclick
  • onblur
  • onfocus
  • onmousedown
  • onmouseup
  • onmouseover
  • onmouseout
  • onsubmit
  • onreset
  • onpropertychange
The click method below was not working: 
Set mainPath = browser("CB").Page("CB")mainPath.WebElement("Search").Click 
but using the FireEvent did work: 
mainPath.WebElement("Search").FireEvent "ondblclick"

No comments:

Post a Comment