Using "sendKeys" command at place of "type" command in selenium with example

Selenium IDE "sendKeys" command

"sendKeys" command works like type command in selenium IDE but there are 2 more functions as bellow in "sendKeys" command which are not available in "type" command. Generally "sendKeys" command is very useful in auto complete text boxes or combo boxes which require explicit key events.

1. "sendKeys" command will not replace the existing text content in the text box where as "type" command
will replace the existing text content of the text box.

2. It will send explicit key(like user pressing key of key board) events with the key so it will work same as user typing word using key board.

Difference between "type" and "sendKeys" command
Let me give you simple example so you can get it better.

New Test


Run above example in your browser. First "type" commands will type 'b' into the text box, 2nd "type" commands will type 'a' (replacing 'b') into the text box, 3rd "type" commands will type 's' (replacing 'a') into the text box. During execution of all three type command, you need to observe that is it showing any word suggestion bellow text box? I am pretty sure it will not show any suggestion.

Look at the text box during the execution of 1st "sendKeys" command. There will be display 3 word suggestions ('BASIC', 'COBOL' and 'Ruby') bellow the text box when selenium send 'b' into text box. Now when selenium sends 2nd key 'a' to text box, it will not replace existing text 'b' but it will be added with existing text and now it will becomes 'ba' and will show you word suggestion ('BASIC') bellow the text box. 

Run and observe execution of "type" and "sendKeys" commands on text box to get it clearly. "sendKeys"  command will Simulate the Keyboard Keypress Event.

"refreshAndWait" Command in selenium
In above example, there is one more command with name "refreshAndWait". It will refresh the page and will wait until page not get reloaded properly.


  1. In May case its not happening .I am using senKeys command but suggession is no getting.When i am typing manually through keyboard, i am getting sugessions.

  2. Hello, I have similar issue. But when I use sendKeys first, then suggestion appears(after some wait),then I navigate away from site, then back, and when I use sendKeys 2nd time, the suggestion is not shown. Any ideas?