简体   繁体   中英

How to enter Comment in Android app pop up using Appium

I am working on an automation Android app using Appium and Java. 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");
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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