![](/img/trans.png)
[英]Scroll and click - Not working for both Android and iOS on Appium tool with selenium java
[英]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.