Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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

I have the following code piece in java using selenium inorder to access UI element on iOS and populate a textfield.

WebElement username = driver.findElement(By.xpath("//window[1]/textfield[1]"));;

The sendKeys() method accesses the keyboard of the phone and i want to be able to do the same without accessing the keyboard of the phone.Is there some way to do this by kind of setting the value in code without using keyboard of the phone.

share|improve this question

One way I can think of a avoiding using sendKeys() is to execute a Javascript function that will set the value of the web element. The below example assumes JQuery is available on the page:

share|improve this answer
Using pure javascript is pretty simple too: driver.executeScript("arguments[0].value = 'User'", username); – Sam Woods Nov 5 '13 at 18:34

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.