Forum Discussion
Hi Robert,
Error coming up on my application.
I am assuming that the text entered in the textfields are not pushed to the database after clicking on the Save button.
It's working fine with the Keys method.
Couple of questions still:
What version of TC are you using?
Are there "OnChange" events that trigger based upon clicking in or clicking out of a field?
The reason I ask is that it sounds like SetText is not properly triggering those "OnChange" events. This was, IIRC, something that was fixed in a more recent version of TC so I'm curious as to why it's not working for you.
- RajTC10 years agoOccasional Contributor
Hi Robert,
I am using the Testcomplete Version 11.31 Build 2420
Yes, Actually my application has inline validations for mandatory text fields. While entering the username in username edit box it will validate the conditions instantly.
- ghuff210 years agoContributor
Well SetText() should trigger the OnChange javascript event in that version of TestComplete, I believe it was added in 11.31. From the SetText docs:
The SetText action does not activate the application window that contains the control, though it moves the insertion point to the beginning of the control’s text. Unlike the wText (for edit controls) and the wText (for combo box controls) properties, SetText fails when it is applied to a disabled or read-only control.
The SetText action works differently for web and desktop objects. For test objects in desktop applications, the action raises only text change events and does not raise keystroke events. For test objects on web pages, the action fires the onchange event (a “text change” event), and “keystroke” events like keyup, input and keydown that may trigger keyboard-related scripts (for example, autocompletion popups). Anyway, if the expected event does not occur, try using the Keys action.
So as you can see the SetText method should fire any of the normal keyboard events. Do you know which specific event needs to be triggered in your application? If it's not one of the ones listed above then you'll have to use the Keys() method. Otherwise you might want to consider opening a support ticket with SmartBear, they added support for triggering these events with SetText very recently so there might just be a bug that needs to be fixed.
- RajTC10 years agoOccasional Contributor
Following events are used in my application.
focus, blur (leave), change
SetText method support these events?