uiautomator UiSelector

Appium enables searching using UiSelectors. UiScrollable is also supported.//Uiselector和UiScrollable两种定位方式。

Note that the index selector is unreliable so prefer instance instead. The following examples are written against the api demos apk using Ruby.

Find the first textview.

 # ruby
first_textview = find_element(:uiautomator, 'new UiSelector().className("android.widget.TextView").instance(0)');

Find the first element by text.

 # ruby
first_text = find_element(:uiautomator, 'new UiSelector().text("Animation")')
first_text.text # "Animation"

Find the first scrollable element, then find a TextView with the text “Tabs”. The “Tabs” element will be scrolled into view.

 # ruby
element = find_element(:uiautomator, 'new UiScrollable(new UiSelector().scrollable(true).instance(0)).getChildByText(new UiSelector().className("android.widget.TextView"), "Tabs")')

As a special case, scrollIntoView returns the element that is scrolled into view. scrollIntoView allows scrolling to any UiSelector.

appium(9)-uiautomator UiSelector的更多相关文章

  1. Appium之uiautomator定位元素

    元素定位方式有多种,Android也有自身独有的定位方式.下面就单独介绍其基于uiautomator定位元素的方法: 基本语法: driver.find_element_by_android_uiau ...

  2. Android无线测试之—UiAutomator UiSelector API介绍之七

    对象搜索—索引与实例 一.索引与实例说明: 1)index:在同一级中的编号,在兄弟类中组件的编号,index从0开始 2)instance:同一个布局中同一类组件的编号,instance从0开始 二 ...

  3. Android无线测试之—UiAutomator UiSelector API介绍之六

    对象搜索—类名与包名 一.类名属性定位对象 返回值 API 描述 UiSelector calssName(String className) 完整类名匹配 UiSelector calssNameM ...

  4. Android无线测试之—UiAutomator UiSelector API介绍之五

    对象搜索—文本与描述 一.文本属性定位对象: 返回值 API 描述 UiSelector test(String text) 文本完全匹配 UiSelector testContains(String ...

  5. Android无线测试之—UiAutomator UiSelector API介绍之四

    四种匹配关系介绍 一.四种匹配关系介绍: 二.举例: 匹配字符串   0123456789 1.完全匹配: 0123456789 2.包含匹配: 45678.456.678 3.正则匹配: \d{10 ...

  6. Android无线测试之—UiAutomator UiSelector API介绍之一

    一. UiSelector类介绍: 1) UiSelector类说明: UiSelector代表一种搜索条件,可以在当前界面上查询和获取特定元素的句柄,当找到多余一个的匹配元素,则返回布局层次结构上第 ...

  7. Appium之UIAutomator API选择元素

    UI Automator测试框架提供了一组API来构建UI测试. 利用UI Automator API可以执行在测试设备中,打开‘设置’菜单或应用启动器等操作. UI Automator测试框架非常适 ...

  8. Android无线测试之—UiAutomator UiSelector API介绍之八

    对象搜索—特殊属性.节点与资源ID 一.特殊属性定位对象相关API 返回值 API 描述 UiSelector checkableboolean val) 是否可选择,一般开关组件上具有checkab ...

  9. Android无线测试之—UiAutomator UiSelector API介绍之三

    节点关系介绍 每一个布局文件都是一个严格的层次结构布局文件,只有对层次结构非常的了解,才能更好的搜索定位我们需要的主键元素 一.XML文档节点关系介绍 备注:查看节点关系主要使用UiAutomatro ...

随机推荐

  1. LeetCode OJ--Unique Paths *

    https://oj.leetcode.com/problems/unique-paths/ 首先,转换成一个排列组合问题,计算组合数C(m+n-2) (m-1),请自动想象成上下标. class S ...

  2. 本地安装Sass,Compass

    使用本地的gem文件来安装Sass和Compass. 1.安装Ruby http://rubyinstaller.org/downloads/ 下载之后双击安装即可,在安装过程中可以选择“Add Ru ...

  3. 什么情况下应该使用Web Service?

    现在我将列举三种情况,在这三种情况下,你将会发现使用Web service会带来极大的好处.此后,我还会举出不应该使用Web service的一些情况. 跨越防火墙的通信 如果你的应用程序有成千上万的 ...

  4. PV、PVC、StorageClass讲解

    PV.PVC.StorageClass讲解 为了方便开发人员更加容易的使用存储才出现的概念.通常我们在一个POD中定义使用存储是这样的方式,我们以hostpath类型来说: apiVersion: v ...

  5. zip 压缩文件夹

    import java.io.*; import java.util.zip.*; /** * @author Dana·Li * <p> * 程序实现了ZIP压缩[compression ...

  6. mybatis学习网站

    http://www.mybatis.org/mybatis-3/zh/index.html

  7. ubuntu安装常用软件

    安装unzip sudo apt-get install unzip

  8. 椭圆人头跟踪bmp图像序列 BMP Image Sequences for Elliptical Head Tracking

    BMP Image Sequences for Elliptical Head Tracking The BMP image sequences used in the head tracking d ...

  9. 关于#!/usr/bin/env python 的用法

    在linux的一些脚本里,需在开头一行指定脚本的解释程序,如: !/usr/bin/env python 再如: !/usr/bin/env perl 那么 env到底有什么用?何时用这个呢?脚本用e ...

  10. AngularJS的form状态变色

    代码下载:https://files.cnblogs.com/files/xiandedanteng/angularjsChangeFormClass.rar 代码: <!DOCTYPE HTM ...