What to use in place of setText() or sendKeys() in javascript?

I have tried using both setText() and sendKeys() to enter text into the textbox like:

    return driver.elementById(this.mobileNumberTextBox)

But I have noticed that about 3 out of 10 cases are failing randomly because of sendKeys()/setText().It also takes a long time for this one command to execute which is slowing down the entire test execution cycle.Sometimes randomly the keyboard opens and keypress is executed along with the supplied string.

How can I solve this issue?Is there any other method of entering text in the texbox.A solution in javascript format will be very much appreciated.


use setValue() instead sendKeys() for text fields.

Vijay Bhaskar.

I was able to fix the random keyboard keypress issue with setText() using desired caps:


Now my only problem is to speed up the process.Will try out setValue() today and let you know the results.


Tried using setValue() but seems like its not a valid command in javascript.

TypeError: driver.elementById(...).click(...).setValue is not a function