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')]"); 

  • 相关阅读:
    农场灌溉问题(回溯)
    六数码问题(广搜_队列)
    求图像周长(回溯)
    六数码问题(回溯)
    花生米(四)
    活动安排(贪心算法)
    自我介绍
    三位老师
    培训期间
    工作十个月感触
  • 原文地址:https://www.cnblogs.com/penghong2014/p/4269862.html
Copyright © 2011-2022 走看看