Many a times we want to simulate keyboard strokes in our selenium tests. Here is how you can do this using Selenium1.
Command: selenium.keyPressNative(<KeyEvent_TobePassed>);
For Ex: If you want to simulate pressing Tab then you need to pass the command:
selenium.keyPressNative(java.awt.event.KeyEvent.VK_TAB+"");
View the list of KeyEvents here: http://docs.oracle.com/javase/1.4.2/docs/api/java/awt/event/KeyEvent.html
Hope this helps!
Comments