我正在测试我的应用。我有一个文本字段,首先我输入字母,然后我将键盘更改为数字并输入数字,以便我得到一个字符串qwerty123
。但UIAutomation不明白这一点。当我运行此脚本时,它在行"tap point object is required"
处显示"target.frontMostApp().keyboard().typeString("qwerty123\n");"
如何解释键盘已更改?
答案 0 :(得分:0)
您可以使用setValue设置文本字段值,这将带来键盘窗口并点击键盘中的done元素
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();
答案 1 :(得分:0)
要设置任何字符串,只需使用以下内容:
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.