Page 1 of 1

textfield.value doesn't trigger the event

Posted: Wed Oct 24, 2012 7:45 pm
by omayer
How to trigger event when enterring value in textfield using .value,
inputtag ab = "xpath";
ab.value="testing";
ab.presskeys("{TAB}");
delay.ms(2000);
keyboard.press("{TAB}");
...not able to trigger the (javascript)
Thank you in advance

Re: textfield.value doesn't trigger the event

Posted: Wed Oct 24, 2012 8:47 pm
by Ciege
Setting the value that way, as you found out, does not trigger the fire event the developer has put in the input.

The best and easiest solution, in my mind, is to exactly mimic user's behavior and click into the input, type the chars and exit the input. Just as a user would do, since you are doing functional testing that is supposed to duplicate user's behavior.

Otherwise, you need to learn about how to call your javascript yourself and make sure you call it each and every time that you use the set value method (which may be impossible in some cases). Which, in my mind again, is the wrong way to test since you are circumventing the way the AUT has been developed and designed by your dev team and product management.

Re: textfield.value doesn't trigger the event

Posted: Wed Oct 24, 2012 8:59 pm
by omayer
Thank you Ciege, i did click on input box, didn't try yet typing chars instead of ab.value="testing";

Re: textfield.value doesn't trigger the event

Posted: Wed Oct 24, 2012 9:38 pm
by omayer
tried sending one char at a time same result

Re: textfield.value doesn't trigger the event

Posted: Wed Oct 24, 2012 9:46 pm
by Ciege
try something like this...

Code: Select all

inputtag ab = "xpath"; 
ab.Click(Location.Center, 1000);
Keyboard.Press("Testing{TAB}");

Re: textfield.value doesn't trigger the event

Posted: Thu Oct 25, 2012 4:38 am
by omayer
Thank you again for helping this out, sending one char worked , had to put some delay