zoukankan      html  css  js  c++  java
  • uiautomator

    uiautomator方法定位app元素: 
    appium在android端是调用其底层的UIAutomator2自动化测试框架去驱动自 
    动化,在定位元素的时候,可以借助UIAutomator2的语法来实现定位。在代码 
    实现上提供的API是find_element_by_android_uiautomator。 
    1、根据text定位: 
    find_element_by_android_uiautomator('text("值")') 
    find_element_by_android_uiautomator('new UiSelector().text("值")') 
    text定位相关函数: 
    textContains:模糊匹配文本 
    textStartsWith:以某个文本开头来匹配 
    textMatches:正则匹配
     
    uiautomator方法定位app元素: 
    2、根据resourceId定位: 
    find_element_by_android_uiautomator('resourceId("值")') 
    find_element_by_android_uiautomator('new UiSelector().resourceId("值")') 
    3、根据className定位: 关键字 className 
    4、根据contenet-des定位: 关键字 description 
    5、组合定位(类名和文本): 
    new UiSelector().className("类名").text("值") 
    其它组合定位方式类推
     
    uiautomator方法定位app元素: 
    6、根据元素关系定位: 
    1)后代元素定位 
    使用条件:子元素属性不定,不唯一,只能通过父元素来定位 
    new UiSelector().resourceId("值").childSelector(className("值").instance(数字)) 
    其中childSelector可以传入resourceId、description等方法 
    instance表示匹配的结果所有元素里面的第几个元素,从0开始计数 
    2)兄弟元素定位 
    通过子元素找到父元素,然后通过父元素再去找兄弟元素 
    new UiSelector().resourceId("值").fromParent(text("值")) 
    fromParent()表示从元素的父元素下查找
     
    回忆滋润坚持
  • 相关阅读:
    Sharepoint 2010 使用asp.net web应用程序,调试sharepoint程序 解决办法
    sharepoint 管理中心 修改场管理员密码
    Sharepoint 给文档添加评论功能
    Sharepoint 修改评分列数据显示图标的颜色 (等级)
    sharepoint 启用评分功能
    sharepoint 获取术语集源的术语并绑定到下拉列表中
    逆元 板子
    CodeForces
    SPOJ
    [HAOI2011]Problem b 题解
  • 原文地址:https://www.cnblogs.com/james5d/p/14165775.html
Copyright © 2011-2022 走看看