簡體   English   中英

如何使用Appium在Android應用彈出窗口中輸入評論

[英]How to enter Comment in Android app pop up using 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");
        }

這是幫助您的屏幕截圖

屏幕截圖

首先,您必須點擊該字段並執行命令

修改后的代碼:

 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