温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Appium+python中元素定位uiautomatorviewer是怎样的

发布时间:2021-09-28 10:50:51 来源:亿速云 阅读:146 作者:柒染 栏目:大数据

这期内容当中小编将会给大家带来有关Appium+python中元素定位uiautomatorviewer是怎样的,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

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

uiautomatorviewer是android-sdk自带的一个元素定位工具,非常简单好用,使用uiautomatorviewer,你可以检查一个应用的UI来查看应用的布局和组件以及相关的属性。

一、启动uiautomatorviewer.bat

    1.打开目录D:\androidsdk\android-sdk-windows\tools

Appium+python中元素定位uiautomatorviewer是怎样的

1472105236126324.png850x502 53 KB

    2.双击启动,启动之后出现如下界面

Appium+python中元素定位uiautomatorviewer是怎样的



二、连接手机

    1.cmd打开输入adb devices,确认手机已连上

    2.打开手机淘宝页面,让屏幕处于点亮状态

    3.点左上角安卓机器人按钮Devices Screenshot按钮刷新页面

Appium+python中元素定位uiautomatorviewer是怎样的

   2.右下角可以看到元素对应的属性

text:搭配新宠不能缺

resource-id:com.taobao.taobao:id/home_searchedit

class:android.widget.EditText



四、点搜索框

    1.前面一篇启动app后,休眠五秒,等待页面加载完成

    2.通过id来定位到搜索框,然后点击

Appium+python中元素定位uiautomatorviewer是怎样的

   2.多的三种如下,在后面的会详细介绍

driver.find_element_by_accessibility_id()

driver.find_element_by_android_uiautomator()

driver.find_element_by_ios_uiautomation()

(第三个是ios的可以暂时不用管)


uiautomatorviewer是android sdk自带的

上述就是小编为大家分享的Appium+python中元素定位uiautomatorviewer是怎样的了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注亿速云行业资讯频道。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI