一、uiautomatorviewer元素定位

1.adroid-sdk的安装目录tools下有1个自带的工具uiautomatorviewer,打开后,如下所示:

点击后,如图所示:

步骤:

a.链接设备,打开APP

b.点击页面设备图标,刷新页面,与设备页面同步

c.点击需要定位的元素

d.在Node Detail模块,查看resource-id

二、元素定位方法

1.findElementById

例:el = driver.findElementById("android:id/title");

assertThat(el.getText(),equalTo("Add note"));

2.findElementByAccessibilityId

例:el = driver.findElementByAccessibilityId("menu_add_note_description");

assertThat(el.getText(),equalTo("node"));

3.findElementByCssSelector

4.findElementByLinkText

5.findElementByPartialLinkText

6.findElementByTagName

7.findEelementByXPath

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

//el = driver.findElement(By.xpath("//android.widget.TextView"));

assertThat(el.getText(),equalTo("Add note"));

Appium元素定位(uiautomatorviewer)的更多相关文章

  1. 4、通过uiautomatorviewer实现appium元素定位

    熟悉selenium自动化的小伙伴应该知道WebDriver 提供了八种元素定位方法: idnameclass nametag namelink textpartial link textxpathc ...

  2. Python Appium 元素定位方法简单介绍

    Python  Appium  元素定位 常用的八种定位方法(与selenium通用) # id定位 driver.find_element_by_id() # name定位 driver.find_ ...

  3. appium元素定位总结

    appium元素定位方法总结 使用uiautomator定位 driver.find_element_by_android_uiautomator(uia_string) 根据resourceId属性 ...

  4. appium元素定位工具

      appium元素定位工具介绍 使用uiautomatorviewer定位工具 使用Appium Inspector定位工具 使用uiautomatorviewer定位工具 谷歌在Android S ...

  5. APP 自动化之appium元素定位(三)

    APP自动化测试关键环节--元素定位,以下我们来了解appium提供的元素定位方法! 1. id定位,id一个控件的唯一标识,由开发人员在项目中指定,如果一个元素有对应的resource-id,我们就 ...

  6. Appium + Python自动化 - 元素定位uiautomatorviewer

    元素定位主要介绍如何使用uiautiomatorviewer,通过定位到页面上的元素,然后进行相应的点击等操作.uiautiomatorviewer是android-sdk自带的一个元素定位工具,非常 ...

  7. Appium+python自动化-元素定位uiautomatorviewer的使用

    前言 环境搭建好了,下一步元素定位,元素定位本篇主要介绍如何使用uiautomatorviewer,通过定位到页面上的元素,然后进行相应的点击等操作. uiautomatorviewer是androi ...

  8. appium 元素定位工具

    两种元素定位工具: 1.uiautomatorviewer是android-sdk自带的一个元素定位工具,目录D:\androidsdk\androidsdk\tools\bin . 双击启动uiau ...

  9. Appium——元素定位

    首先介绍两种定位元素的工具,appium自带的 Inspector 和 android SDK自带的 uiautomatorviewer 1.UIAutomator Viewer比较简单,在模拟器打开 ...

随机推荐

  1. MONO MessageBox 类

    MessageBox类,负责提示各种消息.   using System; using Android.App; using Android.Content; namespace Box { publ ...

  2. 使用NHibernate(1)--资料汇总

    NHibernate最新版本是4.0,目前还只是alpha版,没有发布.稳定版本是3.3,项目中用的也是这个版本,所以以后的介绍都是基于这个版本的. 在网上找了一下相关的学习资料,现汇总如下: NHi ...

  3. PSR2规范

    为了尽可能的提升阅读其他人代码时的效率,下面例举了一系列的通用规则,特别是有关于PHP代码风格的.各个成员项目间的共性组成了这组代码规范.当开发者们在多个项目中合作时,本指南将会成为所有这些项目中共用 ...

  4. hibernate多对一单向关联注解方式

    多对一单向关联,在多的一方加上一的一方作为外键.在程序里表现为:在多的一方加上一的引用. 小组类Group,用户User: Group: package com.oracle.hibernate; i ...

  5. Spring由于web配置导致的spring配置文件找不到的问题的解决方案

    在把某项技术整合到Spring中的时候,我们时常会发现报如下错误: org.springframework.beans.factory.BeanCreationException: Error cre ...

  6. jenkins创建构建任务

    构建项目类型 点击 Jenkins 首页 “创建一个新任务” 的链接, 输入任务名称 Jenkins 提供了六种类型的任务. 构建一个自由风格的软件项目 这是Jenkins的主要功能.Jenkins ...

  7. 《LeetBook》leetcode题解(14):Longest Common Prefix[E]

    我现在在做一个叫<leetbook>的免费开源书项目,力求提供最易懂的中文思路,目前把解题思路都同步更新到gitbook上了,需要的同学可以去看看 书的地址:https://hk029.g ...

  8. CountDownLatch 使用(模拟一场比赛)

    java.util.concurrency中的CountDownLatch,主要用于等待一个或多个其他线程完成任务.CountDownLatch在初始化时,会被赋一个整数,每次执行countDown( ...

  9. 理解Flexbox:你需要知道的一切

    这篇文章介绍了Flexbox模块所有基本概念,而且是介绍Flexbox模块的很好的一篇文章,所以这篇文章非常的长,你要有所准备. 学习Flexbox的曲线 @Philip Roberts在Twitte ...

  10. 分享一个好用的dns