您的位置:首页 > 移动开发

Appium scroll 滑动查找

2016-03-18 09:20 337 查看

首先看uiautomator如何实现滑动查找

UiScrollable scrollView = new UiScrollable(new UiSelector().className("android.widget" +
".ScrollView"));

UiObject itemApps = scrollView.getChildByText(new UiSelector().className("android.widget" +
".TextView"),"Apps");
itemApps.click();

new一个 Uiscrollable 的对象,然后用getChild 的方法找到子元素。

Appium (Python-client)

def _find_by_scroll(self, item_name):

item = self.driver.find_element_by_android_uiautomator(
'new UiScrollable(new UiSelector().scrollable(true).instance(0)).getChildByText(new UiSelector().className("android.widget.TextView"), "'
+ item_name + '")')
item.click()

区别还是有的,用
scrollable(true)
找到对象,
.instance(0)
再获取子元素
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: