Emulate Tab Key in Selenium IDE

6,334 views
Skip to first unread message

Sanjay Ahuja

unread,
Jul 14, 2012, 12:24:58 AM7/14/12
to seleniu...@googlegroups.com
Hi,

There is one scenarion where I enter Smart card number in text box and click on Tab button it will validate the smart card number using AJAX call.
I have to use Selenium IDE for that... Can anyone please advise how to achieve this?

Thanks,
Sanjay

sai kiran nukala

unread,
Jul 14, 2012, 2:56:35 AM7/14/12
to seleniu...@googlegroups.com
You can use KeyPress command as below -

KeyPress <yourTarget> \9

in the above like \9 is ASCII value for TAB key. Try it and tell me if it helps.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.



--
With Regards,
Sai Kiran

Sanjay Ahuja

unread,
Jul 14, 2012, 4:36:31 AM7/14/12
to seleniu...@googlegroups.com, saikiran939
It doesn't work for me :(

let me provide u more information if that can help:

Manual Steps: Enter Smartcard number in textbox >P ress TAB. As soon I press tab system will do ajax call and for 2 seconds. Validate smart card message will be prompted. and it will display client side alert message if the number is not valid.

Selenium IDE: 
1) Command Type - Target XPath of Textbox  - Value 123456789 > This will enter number in textbox.
2) Command KeyPress -  Target XPath of Textbox (same as above) - Value \9

Peter Gale

unread,
Jul 14, 2012, 5:12:07 AM7/14/12
to Selenium Users
Sanjay

Can you be more specific about what is failing?

And when you say it takes 2 seconds for teh AJAX call to action, are you putting an explicit wait to determine when the call has finished, at which point you test may proceed?

Peter


From: ahu...@gmail.com
Date: Sat, 14 Jul 2012 14:06:31 +0530
Subject: Re: [selenium-users] Emulate Tab Key in Selenium IDE
To: seleniu...@googlegroups.com; saiki...@gmail.com

Sanjay Ahuja

unread,
Jul 14, 2012, 6:04:44 AM7/14/12
to seleniu...@googlegroups.com, peterjef...@hotmail.co.uk
Peter,

Please check following screenshot for details. when press tab this Validating SmartCard is displayed for 1-2 sec which is not happening with selenium IDE.

Inline image 2
image.png

Peter Gale

unread,
Jul 14, 2012, 6:17:30 AM7/14/12
to Selenium Users
So ... there are two things that could be going wrong. Either:

1) The Tab Key is not getting sent, or
2) The Javascript which effects the Ajax call is not getting triggered.

I presume that the number is getting entered into the text box, but can you tell if the cursor is definitely on this box when the tab character is sent and that the cursor moves out of this box (and onto the next control if there is one)?

If so then it is the Javascript which is not getting triggered. You could try sending a return character to the box, or in the IDE I htink there is a fireEvent command that you could use to trigger the Javascript event directly, though personally that invalidates your test to my mind.
 

From: ahu...@gmail.com
Date: Sat, 14 Jul 2012 15:34:44 +0530

Subject: Re: [selenium-users] Emulate Tab Key in Selenium IDE
image.png

Sanjay Ahuja

unread,
Jul 14, 2012, 6:42:14 AM7/14/12
to seleniu...@googlegroups.com
Cursor is not at the box and it is also not moving to next control
image.png

Sanjay Ahuja

unread,
Jul 14, 2012, 7:29:38 AM7/14/12
to seleniu...@googlegroups.com, peterjef...@hotmail.co.uk
Following command solves my problem

fireEvent("edit_field_1", "blur");

Thanks for everything
image.png

Niraj Kumar

unread,
Jul 14, 2012, 1:47:40 PM7/14/12
to seleniu...@googlegroups.com, peterjef...@hotmail.co.uk
For this type of issue i have written this.
Please go through this
http://automationtricks.blogspot.in/2010/12/how-to-automate-onblur-through-selenium.html
Thanks & Regard,
Niraj Kumar

image.png
Reply all
Reply to author
Forward
0 new messages