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
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的appium查看控件的方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android 开发中使用Intent传
- 下一篇: WP8.1学习系列(第二十章)——添加控