<listeners>
<!-- 网易arrow插件实现用例失败重跑以及生成测试报告 -->
<listener class-name="org.incito.logistics.logisticsautotest.util.TestResultListener" />
<listener class-name="com.netease.qa.testng.RetryListener" />
<listener class-name="com.netease.qa.testng.PowerEmailableReporter" />
</listeners>
我把这段监听代码去掉 又不报错了 但是我必须用这个监听
#9 楼 @seveniruby windows 版本的有没有录制功能???
下载 Selenium Java 客户端库
下载 Appium 的 Java Client 库.
这 2 个在哪里下载
再次来学习下
有点长,这个是我打印的 ContactManage.apk 的 pagesource
#10 楼 @seveniruby OK 我会谷歌 的 ,刚才我是了下 用了 selenium webdriver 的一个方法:driver.getPageSource() 打出来的是这样的
{
"hierarchy" : {
"@rotation" : "1",
"node" : {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "0",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.FrameLayout",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,0][1280,800]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "0",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.LinearLayout",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,0][1280,800]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : [ {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "0",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.FrameLayout",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,33][1280,66]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "0",
"@text" : "Add Contact",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TextView",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[5,34][1275,64]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false"
}
}, {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "1",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.FrameLayout",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,66][1280,800]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : {
"@enabled" : "true",
"@focusable" : "true",
"@index" : "0",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.ScrollView",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,66][1280,800]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "0",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TableLayout",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,66][1280,497]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : [ {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "0",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TableRow",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,66][1280,93]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "0",
"@text" : "Target Account",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TextView",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,66][332,93]",
"@selected" : "false",
"@content-desc" : "Target Account",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false"
}
}, {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "1",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TableRow",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,93][1280,158]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "0",
"@text" : "",
"@checkable" : "false",
"@scrollable" : "false",
"@package" : "com.example.android.contactmanager",
"@class" : "android.widget.Spinner",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,93][1280,158]",
"@selected" : "false",
"@content-desc" : "",
"@NAF" : "true",
"@clickable" : "true",
"@focused" : "false",
"@checked" : "false"
}
}, {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "2",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TableRow",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,158][1280,185]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "0",
"@text" : "Contact Name",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TextView",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,158][332,185]",
"@selected" : "false",
"@content-desc" : "Contact Name",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false"
}
}, {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "3",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TableRow",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,185][1280,249]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : {
"@enabled" : "true",
"@focusable" : "true",
"@index" : "0",
"@text" : "王 阳",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.EditText",
"@password" : "false",
"@long-clickable" : "true",
"@bounds" : "[0,185][1280,249]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "true",
"@focused" : "false",
"@checked" : "false"
}
}, {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "4",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TableRow",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,249][1280,276]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "0",
"@text" : "Contact Phone",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TextView",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,249][332,276]",
"@selected" : "false",
"@content-desc" : "Contact Phone",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false"
}
}, {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "5",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TableRow",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,276][1280,341]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : [ {
"@enabled" : "true",
"@focusable" : "true",
"@index" : "0",
"@text" : "18872573204",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.EditText",
"@password" : "false",
"@long-clickable" : "true",
"@bounds" : "[0,276][1158,340]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "true",
"@focused" : "false",
"@checked" : "false"
}, {
"@enabled" : "true",
"@focusable" : "true",
"@index" : "1",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "true",
"@class" : "android.widget.Spinner",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[1158,277][1280,342]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "true",
"@focused" : "false",
"@checked" : "false",
"node" : {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "0",
"@text" : "家庭",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TextView",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[1172,292][1212,321]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false"
}
} ]
}, {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "6",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TableRow",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,341][1280,368]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "0",
"@text" : "Contact Email",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TextView",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,341][332,368]",
"@selected" : "false",
"@content-desc" : "Contact Email",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false"
}
}, {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "7",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TableRow",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,368][1280,433]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : [ {
"@enabled" : "true",
"@focusable" : "true",
"@index" : "0",
"@text" : "stephenwang1011@gmail.com",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.EditText",
"@password" : "false",
"@long-clickable" : "true",
"@bounds" : "[0,368][1158,432]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "true",
"@focused" : "true",
"@checked" : "false"
}, {
"@enabled" : "true",
"@focusable" : "true",
"@index" : "1",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "true",
"@class" : "android.widget.Spinner",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[1158,369][1280,434]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "true",
"@focused" : "false",
"@checked" : "false",
"node" : {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "0",
"@text" : "家庭",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TextView",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[1172,384][1212,413]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false"
}
} ]
}, {
"@enabled" : "true",
"@focusable" : "false",
"@index" : "8",
"@text" : "",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.TableRow",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,433][1280,497]",
"@selected" : "false",
"@content-desc" : "",
"@clickable" : "false",
"@focused" : "false",
"@checked" : "false",
"node" : {
"@enabled" : "true",
"@focusable" : "true",
"@index" : "0",
"@text" : "Save",
"@checkable" : "false",
"@package" : "com.example.android.contactmanager",
"@scrollable" : "false",
"@class" : "android.widget.Button",
"@password" : "false",
"@long-clickable" : "false",
"@bounds" : "[0,433][1280,497]",
"@selected" : "false",
"@content-desc" : "Save",
"@clickable" : "true",
"@focused" : "false",
"@checked" : "false"
}
} ]
}
}
} ]
}
}
}
}
#8 楼 @seveniruby 求指导下 如何使用的,谢谢 没用过额
#6 楼 @seveniruby 这个图是你说的 dump 结构吗?
#4 楼 @seveniruby 恩 我试试 之后再说 多谢
#2 楼 @michailclj UI 元素 看不到的
#1 楼 @seveniruby 觉得应该改个名字 类似 by.linkText()
我举得这个完全没有用,我通常的做法是 Thread.sleep() 一下, 具体睡多久自己掂量 很管用 哈哈哈
已经更新截图
顶
谢谢 分享
视频就不做了吧 大家有问题留言
#2 楼 @lihuazhang 所有过程?
其中 的 二、导入 Utf7ImeHelper.java 和相关类到自己的 appium 工程 中可以完全把 这些 java 类 打包成 jar 包 然后使用
WebView 的话能取到内部地址 用 firebug 定位不错哈哈
#7 楼 @seveniruby 我已经自己解决 谢谢
解决方案:打包的时候打成签名版本的 即可
自己解决了 用 sendkey()将以下代码
new UiObject(new UiSelector().className("android.widget.EditText"))
.setText(Utf7ImeHelper.e("你好"));
改成:
textFieldsList.get(0).sendKeys(Utf7ImeHelper.e("王阳"));
即可
@seveniruby 帮我解答下哦 大神 我现在重新打包了一个签名的 apk 安装是成功了 但是没图标 设置默认输入法 自己手动点击 app 的输入框 也没键盘调出