2

I am testing my app. There I have a textfield, where first I enter letters, then I change keyboard to numbers and enter numbers, so that I get a string qwerty123. But UIAutomation doesn't understand this. When I run this script it says "tap point object is required" at the line "target.frontMostApp().keyboard().typeString("qwerty123\n");" How can I explain to it that the keyboard has changed?

Jav_Rock
  • 22,059
  • 20
  • 123
  • 164
Ann
  • 475
  • 1
  • 5
  • 14

2 Answers2

0

To set any string, just use the following:

window.secureTextFields()[0].setValue(""); //Sets textfield to empty. 
app.keyboard().typeString(qwerty123); //Type any string you want
app.keyboard().typeString("\n"); //Press 'Enter'. Also can go in the above line.
Domeniconi
  • 11
  • 1
0

You can set the textfield value with setValue which will bring the keyboard window and tap the done element in the keyboard

textfield.setValue(addressLink); target.frontMostApp().keyboard().elements()["done"].tap();

You can also do following

target.frontMostApp().keyboard().elements()["q"].tap(); target.frontMostApp().keyboard().elements()["w"].tap(); target.frontMostApp().keyboard().elements()["more"].tap(); target.frontMostApp().keyboard().elements()["1"].tap(); target.frontMostApp().keyboard().elements()["2"].tap(); target.frontMostApp().keyboard().elements()["done"].tap();