Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As both of them do the same activity is there any special differences between type and typekeys in selenium webdriver.

wdBacked.type(locator, value);

wdBacked.typeKeys(locator, value);
share|improve this question
Selenium JavaDoc makes some differentiation:…. It says "In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to send the keystroke events corresponding to what you just typed.". Would be interesting to see what they mean by "some cases"... – dzieciou Mar 1 '14 at 12:39
up vote 3 down vote accepted

void type(java.lang.String locator, java.lang.String value) Sets the value of an input field, as though you typed it in.

Inputs the value. Sets the textfield to the value, nothing special. It just takes the entire string and puts it in there at one time.


void typeKeys(java.lang.String locator, java.lang.String value) Simulates keystroke events on the specified element, as though you typed the value key-by-key.

Simulates each keystroke. So if the page has an action that occurs as you type (for example, google's autosuggest), this will be the action you would need. There is also other places where this may be useful but not too many overall.

They are very similar and generally speaking your going to want to use type unless you need to simulate each keystrokes for a reason.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.