我正在使用 Appium 1.6 来自动化 Android UI 测试。
在此图像中,我无法从微调器中选择任何国家/地区(例如:日本)。
这是我正在使用的代码:
driver.findElement(By.id("com.akkipet.android:id/country_spinner__add_information")).click();
driver.findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView("+ "new UiSelector().text(\"India\"));")).click()
我究竟做错了什么?单击微调器后,虽然我无法读取国家/地区值,但我可以读取其他字段,例如名字、姓氏等。
现在,我正在使用点击功能在特定坐标处点击以选择所需的选项。但这将使其特定于设备。此外,由于选项列表因环境而异,我将不得不为每个环境提供一组不同的坐标。
点击代码:
touchAction.tap (200, 850).perform();
有人可以提出更好的解决方法吗?
最佳答案
试试这个。它对我有用。driver.findElement(By.id("com.akkipet.android:id/country_spinner__add_information")).click();
driver.findElement(By.name("India")).click();
关于selenium-webdriver - 无法使用 Appium 1.6 从 Spinner 中选择一个选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44701716/