sendkeys (target, text) and type (target, text) - Selenium IDE command

The sendKeys command works like the type command in the selenium IDE but there are 2 more functions in the "sendKeys" command which are not available in "type" command. Generally the "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.

Note that the "TypeAndWait" command is no longer needed, just as any other WaitForPageToLoad command. Kantu for Chrome uses implicit waiting, just like webDriver.

Special keys supported by Sendkey - use them like this: ${KEY_ENTER}

  • KEY_LEFT (Navigation Left)
  • KEY_UP (Navigation Up)
  • KEY_RIGHT (Navigation Right)
  • KEY_DOWN (Navigation Down)
  • KEY_PGUP / KEY_PAGE_UP (Page up)
  • KEY_PGDN / KEY_PAGE_DOWN (Page down)
  • KEY_BKSP / KEY_BACKSPACE (Backspace)
  • KEY_DEL / KEY_DELETE (Delete)
  • KEY_ENTER (Enter)
  • KEY_TAB (Tab)

Difference between "type" and "sendKeys" command- Example

The examples fills in the Google search box with type, and then does a sendKey with KEY_ENTER to start the search. If you would add ${KEY_ENTER} to the TYPE command, it would just fill in the special character in the input box, but not execute it.

Command Target Pattern/Text
open https://google.com/
Type id=lst-ib Solar Cells Web Automation
sendkeys link=Free Web Automation ${KEY_ENTER}

Works in

Kantu for Chrome Selenium IDE, Kantu for Firefox Selenium IDE, Firefox IDE Classic

Related Demo Macros

Demo-Autofill, Demo-Frame

The ready-to-import-and-run source code of all demo macros can be found in the Github repository testmacros folder.

See also

storeText, Web Automation Extension User Manual, Selenium IDE commands, Classic Firefox Selenium IDE.

Anything wrong or missing on this page? Suggestions?

...then please contact us.

Kantu Selenium IDE for Chrome and Firefox - Web Test Automation
Subscribe to the a9t9 automation software newsletter . We'll send you updates on new releases that we're working on.