繁体   English   中英

无法点击国家名称进入 android 应用程序(Selenium、Java 和 Appium)

[英]Unable to click on country name into android app ( Selenium , Java and Appium )

我无法在 appium selenium java 自动化中的 android 应用程序中单击国家/地区。 我尝试了不同的 xpath 但无法成功。 我正在传递国家名称,我想将它传递给 select,但它不起作用,请帮助我。

我试过以下代码:

    List<MobileElement> countryName = driver.findElements(By.xpath("//android.widget.TextView"));
                 //List <MobileElement> countryName = driver.findElements (By.className ("android.widget.TextView"));
    
       for (int i = 0; i < countryName.size(); i++) {
                     if (countryName.get(i).getText().equalsIgnoreCase(country)) {
     
                         countryName.get(i).click();
                       
                     }
               }[![enter image description here][1]][1]

I have tried following xpath to click on direct country or send country name 
 

 

@AndroidFindBy(xpath = "//android.widget.TextView[@text='哥斯达黎加']")
公共 static WebElement 哥斯达黎加;

 @AndroidFindBy(xpath = "//android.widget.FrameLayout/android.view.ViewGroup/android.view.ViewGroup/android.view.ViewGroup[2]/android.view.ViewGroup/android.view.ViewGroup/android.widget.ScrollView") public static WebElement sendCountryName;

在此处输入图像描述

尝试跟随 xpath,

//*[contains(@text,'Costa Rica')]

大多数情况下它有效,但让我知道它是否有效。

暂无
暂无

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

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