zoukankan      html  css  js  c++  java
  • appium python中的android uiautomator定位

    text定位:
    driver.find_element_by_android_uiautomator('new UiSelector().text("请输入手机号")')

    #模糊定位
    driver.find_element_by_android_uiautomator('new UiSelector().textContains("请输入")')

    resourceID定位:
    driver.find_element_by_android_uiautomator('new UiSelector().resourceId("cn.com.open.mooc:id/et_phone_edit")')

    className定位:
    driver.find_element_by_android_uiautomator('new UiSelector().className("android.widget.EditText")')

    index 定位:
    driver.find_element_by_android_uiautomator('new UiSelector().index(1)')

    className + index 方式:
    driver.find_element_by_android_uiautomator(
    'new UiSelector().className("%s").childSelector(new UiSelector().index("%d"))')

    伪xpath方法定位:

    #通过同级元素定位同级元素
    driver.find_element_by_android_uiautomator(‘new UiSelector().text("Custom View").fromParent(new UiSelector().text("Accessibility Service"))‘).click() 

    #通过父级元素定位子集元素
    driver.find_element_by_android_uiautomator(‘new UiSelector().className("android.widget.ListView").childSelector(new UiSelector().text("Custom View"))‘).click()

    零基础自动化测试群:79887633 软件测试学习交流群:260582237
  • 相关阅读:
    Cpp -- static变量不属于类的实例
    单例模式
    WebView android
    网络编程之一
    初涉json
    初涉XML
    关于JSON的GSON
    网络编程(一)
    硬件51
    重拾C之数据
  • 原文地址:https://www.cnblogs.com/FR-Long/p/9283383.html
Copyright © 2011-2022 走看看