问题描述
我无法在appium硒Java自动化中的android应用中单击国家/地区。我尝试了不同的xpath,但无法成功。我正在传递要选择的国家/地区名称,但是它不起作用,请帮助我。
我尝试了以下代码:
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='Costa Rica']“)
公共静态WebElement CostaRica;@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;
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)