简体   繁体   English

如何使用Appium在Android应用弹出窗口中输入评论

[英]How to enter Comment in Android app pop up using Appium

I am working on an automation Android app using Appium and Java. 我正在使用Appium和Java开发自动化的Android应用程序。 In my app when I click on Finish button there is a pop up. 在我的应用程序中,当我单击“完成”按钮时,会弹出一个窗口。 This pop up requires me to enter some text data. 此弹出窗口要求我输入一些文本数据。 Then a click on the send button finishes the task. 然后单击“发送”按钮即可完成任务。

I am unable to enter a comment. 我无法输入评论。

Can someone please help me out? 有人可以帮我吗?

Here is the code I am using: 这是我正在使用的代码:

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

Here is a Screenshot to help: 这是帮助您的屏幕截图

屏幕截图

First you have to tap on the field and execute the command 首先,您必须点击该字段并执行命令

Edited code : 修改后的代码:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM