如何使用Appium弹出Android应用程序中的注释

时间:2016-12-28 20:30:51

标签: android popup comments appium

我正在使用Appium和Java开发自动化Android应用。在我的应用程序中单击“完成”按钮时会弹出一个弹出窗口。这个弹出窗口要求我输入一些文本数据。然后单击发送按钮完成任务。

我无法发表评论。

有人可以帮帮我吗?

以下是我正在使用的代码:

public void comment() {
        MobileElement EnterComment =
                waitForVisibleElementBy(By.xpath("//android.widget.FrameLayout[@resource-id ='com.staffr.app:id/customPanel']"  + "/android.widget.EditText"),30);
        if (EnterComment != null) {
            EnterComment.sendKeys("This is Automation Test");
        }

以下是Screenshot帮助:

Screenshot

1 个答案:

答案 0 :(得分:0)

首先,您必须点击该字段并执行命令

编辑代码:

 public void comment() {
    MobileElement EnterComment =
            waitForVisibleElementBy(By.xpath("//android.widget.FrameLayout[@resource-id ='com.staffr.app:id/customPanel']"  + "/android.widget.EditText"),30);
    if (EnterComment != null) {
        EnterComment.tap();
        EnterComment.sendKeys("This is Automation Test");
    }