zoukankan      html  css  js  c++  java
  • appium(9)-uiautomator UiSelector

    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.

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

    Find the first element by text.

    1 # ruby
    2 first_text = find_element(:uiautomator, 'new UiSelector().text("Animation")')
    3 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.

    1 # ruby
    2 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.

  • 相关阅读:
    浅谈大学两年
    vue的基本操作
    JS执行环境,作用域链及非块状作用域
    关于AJAX异步请求
    第一个go程序和基本语法
    Golang
    11.二叉树
    10.排序
    9.算法之顺序、二分、hash查找
    高性能异步爬虫
  • 原文地址:https://www.cnblogs.com/superbaby11/p/6067022.html
Copyright © 2011-2022 走看看