zoukankan      html  css  js  c++  java
  • appium查看控件的方法

    1.通过ID查找

      查找1个:WebElement el=driver.findElement(By.id("com.aurora:id/aurora_action_bar_item"));

      列表:      List<WebElement> e3=driver.findElements(By.id("com.aurora:id/aurora_menu_item_text")); 可能会报错

    2.通过name查找

    列表:

    单个:WebElement el = driver.findElement(By.name("Add Contact"));

            driver.findElementByName("Save").click();

    3.通过uiautomator定位

    查找1个:driver.findElementByAndroidUIAutomator("new UiSelector().clickable(true)").click(); 

                 el = driver.findElementByAndroidUIAutomator("new UiSelector().text("Add note")");

    列表:driver.findElementsByAndroidUIAutomator("new UiSelector().clickable(true)").click();

    4.通过Classname查找

    列表:List<WebElement> textFieldsList = driver.findElementsByClassName("android.widget.EditText");

    单个:el = driver.findElementByClassName("android.widget.TextView");

    5.通过content-desc(AccessibilityId)查找

    单个:el = driver.findElementByAccessibilityId("menu_add_note_description"); 

    列表:findElementsByAccessibilityId()

    6.findElementByTagName

    el = driver.findElementByXPath("//android.widget.TextView[contains(@text,'Add note')]"); 

  • 相关阅读:
    for循环
    while循环语句的几种方式
    IF....Else循环
    Python——文件读取
    数据结构之二叉树
    JAVA的免费天气api接口调用示例
    JAVA API
    JAVA爬虫代码
    普通网页怎么改成响应式布局
    循环遍历二叉树
  • 原文地址:https://www.cnblogs.com/penghong2014/p/4269862.html
Copyright © 2011-2022 走看看