Members
client
wdio 创建的实例
- Source
Methods
(async) clickElement(selector)
等待元素出现并点击 示例 await act.clickElement(['id-text', 'cn.some:id', '按钮']);
| Name | Type | Description |
|---|---|---|
selector | string | |
- Source
(async) elementScroll(selector)
滑动元素,从元素底部划到元素顶部,reverse为是否反向,offset正值为向内收缩范围 示例 await act.elementScroll(["id-text", "cn.some:name", "请填写姓名"], true, 1000, [20,20], 'horizontal')
| Name | Type | Description |
|---|---|---|
selector | string | |
- Source
(async) getBrother(selector, target)
获取某个元素的子元素,可选isPlural:第一个/获取所有, 可选超时, 可选useRule自定义规则 示例 await act.getBrother(['desc', '我的订单'], 'className("android.view.View").index(1)');
| Name | Type | Description |
|---|---|---|
selector | string | | |
target | any |
- Source
(async) getElementAttribute(selector, type)
等待元素出现,返回该元素 示例 let element = await act.waitForElement(['id-class', 'cn.some:id', 'android.view.view']);
| Name | Type | Description |
|---|---|---|
selector | string | | |
type | string |
- Source
(async) getElementBox(selector, outeropt)
通过wdio的属性转换成元素坐标。返货盒子外圈坐标[x1,y1,x2,y2]或者中心点 示例 let box= await act.getElementBox(["id-text", "cn.some:name", "请填写姓名"], true)
| Name | Type | Attributes | Description |
|---|---|---|---|
selector | string | | ||
outer | boolean | | <optional> |
- Source
(async) getElements(selector, limitArea)
获取多个内容,可以输入限定区域已确保都能点击到,限制区域x1,x2 ,y1,y2 示例 let ele = await act.getElements(['id', 'com.ss.android.ugc.aweme.lite:id/avatar'],[0,1080,600,1920]);
| Name | Type | Description |
|---|---|---|
selector | string | | |
limitArea | Array.<number> |
- Source
(async) getParentChild(selector, child)
获取某个元素的子元素,可选isPlural:第一个/获取所有, 可选超时, 可选useRule自定义规则 示例 await act.getParentChild(["id", 'id:app'], ["class", "android.view.View"], true, 20000, {func: findBtn, param: '123456'})
| Name | Type | Description |
|---|---|---|
selector | string | | |
child | string |
- Source
handleSelector(str)
处理传入的selector。数组通过uis转换为字符串。
| Name | Type | Description |
|---|---|---|
str | string | |
- Source
(async) screenScroll(axies)
滑动屏幕,可以分段执行。durations要么只传一个,要么和end坐标数量相同 示例 await act.screenScroll([startX,startY,[endX1,endY1],[endX2,endY2],[endX3,endY3]...] , [800,700,600])
| Name | Type | Description |
|---|---|---|
axies | string | |
- Source
(async) searchWithAttribute(selector, attribute, value)
通过属性查找元素。 示例 let element= await act.searchWithAttribute(['class', 'android.widget.EditText'], 'hint', '请输入姓名')
| Name | Type | Description |
|---|---|---|
selector | string | | |
attribute | any | |
value | any |
- Source
(async) typeInput(selector, value)
等待input出现并输入文字,是否清除原文字可选,不会触发键盘弹出(某些权限响应) 示例 await act.typeInput(["id-text", "cn.some:name", "请填写姓名"],'myName');
| Name | Type | Description |
|---|---|---|
selector | string | | |
value | any |
- Source
uis(type, opt)
UiSelector不同形式的选择器,可以组合。 示例['id-class-text','id:aaabbb','android.view.view','文本']
| Name | Type | Description |
|---|---|---|
type | string | |
opt | Array.<string> |
- Source
(async) waitForElement(selector)
等待元素出现,返回该元素 示例 let element = await act.waitForElement(['id-class', 'cn.some:id', 'android.view.view']);
| Name | Type | Description |
|---|---|---|
selector | string | |
- Source