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. The sendKeys" command does not replace the existing text content in the text box whereas the "type" command replaces the existing text content of the text box.

2. It will send explicit key events like a user pressing a key on the keyboard. This means it will kind of work same as user typing a word using the keyboard. Note that we say "kind of work same" because all Selenium IDE commands operate on the Javascript level inside the browser's DOM. They do not generate native OS events. So if "sendkeys" fails, use XType. For more information see XType vs Sendkey.

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

Note that the "Focus" command is no longer needed. With Kantu, the type, sendkey and click commands automatically set the focus on the element they fill out or click on. Just noate that the browser window in which you replay must be brought to foreground to make focus work. This is not a restriction of Kantu, but this is how the focus works: Only windows that are in the foreground can have the focus. You can use the BringBrowserToForeground command to make sure the right tab is in the foreground.

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)

NEW: With the XType command UI.Vision RPA can simulate native keyboard events . In other words, XType is a much more powerful "sendkeys" command than the Javascript based Type and Sendkeys Selenium IDE commands described on this page. So if Type and Sendkeys do not work for you, make sure to try XType - it will work. See also XType vs (Selenium IDE) Type/Sendkey.

Important: For desktop automation you must use XTYPE. The Sendkey and Type commands always work only inside a web page.

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
Type id=lst-ib Solar Cells Web Automation
sendkeys link=Free Web Automation ${KEY_ENTER}

Works in

UI.Vision RPA for Chrome Selenium IDE, UI.Vision RPA 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.

<em>UI.Vision RPA</em> Selenium IDE for Chrome and Firefox - Web Test Automation
Subscribe to the UI Vision RPA software newsletter . We'll send you updates on new releases that we're working on.