textfield.value doesn't trigger the event

Ask general questions here.
omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

textfield.value doesn't trigger the event

Post by omayer » Wed Oct 24, 2012 7:45 pm

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
Tipu

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: textfield.value doesn't trigger the event

Post by Ciege » Wed Oct 24, 2012 8:47 pm

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.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: textfield.value doesn't trigger the event

Post by omayer » Wed Oct 24, 2012 8:59 pm

Thank you Ciege, i did click on input box, didn't try yet typing chars instead of ab.value="testing";
Tipu

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: textfield.value doesn't trigger the event

Post by omayer » Wed Oct 24, 2012 9:38 pm

tried sending one char at a time same result
Tipu

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: textfield.value doesn't trigger the event

Post by Ciege » Wed Oct 24, 2012 9:46 pm

try something like this...

Code: Select all

inputtag ab = "xpath"; 
ab.Click(Location.Center, 1000);
Keyboard.Press("Testing{TAB}");
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

omayer
Posts: 458
Joined: Thu Oct 28, 2010 6:14 pm

Re: textfield.value doesn't trigger the event

Post by omayer » Thu Oct 25, 2012 4:38 am

Thank you again for helping this out, sending one char worked , had to put some delay
Tipu