您的位置:首页 > 移动开发

Appium查找元素

2016-07-08 15:09 393 查看
记录一些需要记忆的查找元素的内容:

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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: