Appium查找元素

 记录一些需要记忆的查找元素的内容:

1. driver.findElement(By.name("DELETE");   //We can use the DELETE text to locate the DELETE button as Name。

2. driver. findElementByAccessibilityId("plus");  //We can use content-desc as AccId to perform an action on the + sign.

3. For example, resource-id as com.android.calculator2:id/equal. We can use resource-id as UIAuto to perform an action on the = sign. This is how the command will look:WebElement equal=driver. findElementByAndroidUIAutomator("new UiSelector().resourceId("com.android.calculator2:id/equal")";

Another example is to pick content-desc as equals, so the command will look like this: WebElement equal=driver. findElementBy.AndroidUIAutomator("new UiSelector().description("equals")");

4. 

原文地址:https://www.cnblogs.com/Lihao2013/p/5653440.html