【问题标题】:How to enter Comment in Android app pop up using Appium如何使用 Appium 在弹出的 Android 应用中输入评论
【发布时间】:2017-05-13 03:56:22
【问题描述】:

我正在开发一个使用 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 来帮忙:

【问题讨论】:

  • 请您在执行 sendkey 命令时将错误告诉我。

标签: android popup comments appium


【解决方案1】:

首先你必须点击字段并执行命令

编辑代码:

 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");
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-06-16
    • 1970-01-01
    • 1970-01-01
    • 2017-02-26
    • 1970-01-01
    • 2014-06-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多