Forum Discussion

DCat1223's avatar
DCat1223
Frequent Contributor
9 years ago
Solved

Function onchange event doesn't work with automation

Hi...  I have a keyword test for an application that is used for employees to enroll in healthcare.  My company charges less for healthcare for an employee's spouse if the spouse is an employee also....
  • tristaanogre's avatar
    9 years ago

    What step are you executing on the field in question?  If you're using something like "SetText" or similar call, that is not going to trigger an "onchange" event.  Usually, in my experience, those fire when a user actually clicks or tabs out of a field in order to register the actual change.

     

    WorkAround #1: For the field that you know is going to trigger the onchange, once you've entered the data, actually call a "Click" or "Keys" function on the next field to trigger the event

     

    WorkAround #2: Now, this worked for me on a desktop application, but you might be able to call Object.OnChange() directly within your test scripts. I'm not sure if this is available for a web application but it's something to investigate.

     

    Either of these SHOULD trigger your onchange event.

    Let me know if this helps

  • ghuff2's avatar
    9 years ago

    How are you interacting with the textbox through TestComplete? Are you calling the SetText() method or the Keys() method when inputting text? If you are using SetText() try using the Keys() method instead as that should trigger the onchange event for the textbox.