Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
d6f7cf63
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d6f7cf63
编写于
3月 24, 2022
作者:
Z
zhouke
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
amend js-apis-uitest.md. Signed-off-by: <zhouke25@huawei.com>.
Signed-off-by:
N
zhouke
<
zhouke25@huawe.com
>
上级
c7638e91
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
145 addition
and
44 deletion
+145
-44
zh-cn/application-dev/reference/apis/js-apis-uitest.md
zh-cn/application-dev/reference/apis/js-apis-uitest.md
+145
-44
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-uitest.md
浏览文件 @
d6f7cf63
...
@@ -316,7 +316,7 @@ isBefore(by:By):By;
...
@@ -316,7 +316,7 @@ isBefore(by:By):By;
**示例:**
**示例:**
```
```
let by = BY.isBefore(
by
.text('123')) //使用静态构造器BY创建by对象,指定目标控件位于给出的特征属性控件之前
let by = BY.isBefore(
BY
.text('123')) //使用静态构造器BY创建by对象,指定目标控件位于给出的特征属性控件之前
```
```
### By.isAfter
### By.isAfter
...
@@ -344,7 +344,7 @@ isAfter(by:By):By;
...
@@ -344,7 +344,7 @@ isAfter(by:By):By;
**示例:**
**示例:**
```
```
let by = BY.isAfter(
by
.text('123')) //使用静态构造器BY创建by对象,指定目标控件位于给出的特征属性控件之后
let by = BY.isAfter(
BY
.text('123')) //使用静态构造器BY创建by对象,指定目标控件位于给出的特征属性控件之后
```
```
## UiComponent
## UiComponent
...
@@ -365,7 +365,11 @@ click():Promise<void>;
...
@@ -365,7 +365,11 @@ click():Promise<void>;
**示例:**
**示例:**
```
```
await button.click()
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
button
=
await
driver
.
findComponent
(
BY
.
type
(
'button'
))
await
button
.
click
()
}
```
```
### UiComponent.doubleClick
### UiComponent.doubleClick
...
@@ -381,7 +385,11 @@ doubleClick():Promise<void>;
...
@@ -381,7 +385,11 @@ doubleClick():Promise<void>;
**示例:**
**示例:**
```
```
await buttont.doubleClick()
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
button
=
await
driver
.
findComponent
(
BY
.
type
(
'button'
))
await
buttont
.
doubleClick
()
}
```
```
### UiComponent.longClick
### UiComponent.longClick
...
@@ -397,7 +405,11 @@ longClick():Promise<void>;
...
@@ -397,7 +405,11 @@ longClick():Promise<void>;
**示例:**
**示例:**
```
```
await button.longClick()
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
button
=
await
driver
.
findComponent
(
BY
.
type
(
'button'
))
await
button
.
longClick
()
}
```
```
### UiComponent.getId
### UiComponent.getId
...
@@ -419,7 +431,11 @@ getId():Promise<number>;
...
@@ -419,7 +431,11 @@ getId():Promise<number>;
**示例:**
**示例:**
```
```
let num = await button.getId()
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
button
=
await
driver
.
findComponent
(
BY
.
type
(
'button'
))
let
num
=
await
button
.
getId
()
}
```
```
### UiComponent.getKey
### UiComponent.getKey
...
@@ -441,7 +457,11 @@ getKey():Promise<string>;
...
@@ -441,7 +457,11 @@ getKey():Promise<string>;
**示例:**
**示例:**
```
```
let str_key = await button.getKey()
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
button
=
await
driver
.
findComponent
(
BY
.
type
(
'button'
))
let
str_key
=
await
button
.
getKey
()
}
```
```
### UiComponent.getText
### UiComponent.getText
...
@@ -463,7 +483,11 @@ getText():Promise<string>;
...
@@ -463,7 +483,11 @@ getText():Promise<string>;
**示例:**
**示例:**
```
```
let text = await button.getText()
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
button
=
await
driver
.
findComponent
(
BY
.
type
(
'button'
))
let
text
=
await
button
.
getText
()
}
```
```
### UiComponent.getType
### UiComponent.getType
...
@@ -485,7 +509,11 @@ getType():Promise<string>;
...
@@ -485,7 +509,11 @@ getType():Promise<string>;
**示例:**
**示例:**
```
```
let type =await button.getType()
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
button
=
await
driver
.
findComponent
(
BY
.
type
(
'button'
))
let
type
=
await
button
.
getType
()
}
```
```
### UiComponent.isClickable
### UiComponent.isClickable
...
@@ -507,11 +535,16 @@ isClickable():Promise<bool>;
...
@@ -507,11 +535,16 @@ isClickable():Promise<bool>;
**示例:**
**示例:**
```
```
if(await button.isClickable())
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
button
=
await
driver
.
findComponent
(
BY
.
type
(
'button'
))
if
(
await
button
.
isClickable
())
{
console
.
info
(
'This button can be Clicked'
)
console
.
info
(
'This button can be Clicked'
)
else
}
else
{
console
.
info
(
'This button can not be Clicked'
)
console
.
info
(
'This button can not be Clicked'
)
}
}
```
```
### UiComponent.isScrollable
### UiComponent.isScrollable
...
@@ -533,10 +566,16 @@ isScrollable():Promise<bool>;
...
@@ -533,10 +566,16 @@ isScrollable():Promise<bool>;
**示例:**
**示例:**
```
```
if(await scrollBar.isScrollable())
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
scrollBar
=
await
driver
.
findComponent
(
BY
.
scrollable
(
true
))
if
(
await
scrollBar
.
isScrollable
())
{
console
.
info
(
'This scrollBar can be operated'
)
console
.
info
(
'This scrollBar can be operated'
)
else
}
else
{
console
.
info
(
'This scrollBar can not be operated'
)
console
.
info
(
'This scrollBar can not be operated'
)
}
}
```
```
...
@@ -559,10 +598,17 @@ isEnabled():Promise<bool>;
...
@@ -559,10 +598,17 @@ isEnabled():Promise<bool>;
**示例:**
**示例:**
```
```
if(await button.isEnabled())
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
button
=
await
driver
.
findComponent
(
BY
.
type
(
'button'
))
if
(
await
button
.
isEnabled
())
{
console
.
info
(
'This button can be operated'
)
console
.
info
(
'This button can be operated'
)
else
}
else
{
console
.
info
(
'This button can not be operated'
)
console
.
info
(
'This button can not be operated'
)
}
}
```
```
### UiComponent.isFocused
### UiComponent.isFocused
...
@@ -584,10 +630,16 @@ isFocused():Promise<bool>;
...
@@ -584,10 +630,16 @@ isFocused():Promise<bool>;
**示例:**
**示例:**
```
```
if(await button.isFocused())
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
button
=
await
driver
.
findComponent
(
BY
.
type
(
'button'
))
if
(
await
button
.
isFocused
())
{
console
.
info
(
'This button is focused'
)
console
.
info
(
'This button is focused'
)
else
}
else
{
console
.
info
(
'This button is not focused'
)
console
.
info
(
'This button is not focused'
)
}
}
```
```
### UiComponent.isSelected
### UiComponent.isSelected
...
@@ -609,10 +661,16 @@ isSelected():Promise<bool>;
...
@@ -609,10 +661,16 @@ isSelected():Promise<bool>;
**示例:**
**示例:**
```
```
if(await button.isSelected())
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
button
=
await
driver
.
findComponent
(
BY
.
type
(
'button'
))
if
(
await
button
.
isSelected
())
{
console
.
info
(
'This button is selected'
)
console
.
info
(
'This button is selected'
)
else
}
else
{
console
.
info
(
'This button is not selected'
)
console
.
info
(
'This button is not selected'
)
}
}
```
```
### UiComponent.inputText
### UiComponent.inputText
...
@@ -634,7 +692,11 @@ inputText(text: string):Promise<void>;
...
@@ -634,7 +692,11 @@ inputText(text: string):Promise<void>;
**示例:**
**示例:**
```
```
await button.inputText('next page')
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
button
=
await
driver
.
findComponent
(
BY
.
type
(
'button'
))
await
button
.
inputText
(
'next page'
)
}
```
```
### UiComponent.scrollSearch
### UiComponent.scrollSearch
...
@@ -662,7 +724,11 @@ scrollSearch(by:By):Promise<UiComponent>;
...
@@ -662,7 +724,11 @@ scrollSearch(by:By):Promise<UiComponent>;
**示例:**
**示例:**
```
```
let button = await scrollBar.scrollSearch(By.text('next page'))
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
scrollBar
=
await
driver
.
findComponent
(
BY
.
scrollable
(
true
))
let
button
=
await
scrollBar
.
scrollSearch
(
BY
.
text
(
'next page'
))
}
```
```
## UiDriver
## UiDriver
...
@@ -689,7 +755,9 @@ static create():UiDriver;
...
@@ -689,7 +755,9 @@ static create():UiDriver;
**示例:**
**示例:**
```
```
let driver = UiDriver.create()
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
}
```
```
### UiDriver.delayMs
### UiDriver.delayMs
...
@@ -711,7 +779,10 @@ UiDriver对象在给定的时间内延时。
...
@@ -711,7 +779,10 @@ UiDriver对象在给定的时间内延时。
**示例:**
**示例:**
```
```
await UiDriver.delayMs(1000)
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
delayMs
(
1000
)
}
```
```
### UiDriver.findComponent
### UiDriver.findComponent
...
@@ -739,7 +810,10 @@ findComponent(by:By):Promise<UiComponent>;
...
@@ -739,7 +810,10 @@ findComponent(by:By):Promise<UiComponent>;
**示例:**
**示例:**
```
```
let button = await UiDriver.findComponent(By.text('next page'))
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
button
=
await
driver
.
findComponent
(
BY
.
text
(
'next page'
))
}
```
```
### UiDriver.findComponents
### UiDriver.findComponents
...
@@ -767,7 +841,10 @@ findComponents(by:By):Promise<Array<UiComponent>>;
...
@@ -767,7 +841,10 @@ findComponents(by:By):Promise<Array<UiComponent>>;
**示例:**
**示例:**
```
```
let <Array<button>> = await UiDriver.findComponents(By.text('next page'))
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
let
buttonList
=
await
driver
.
findComponents
(
BY
.
text
(
'next page'
))
}
```
```
### UiDriver.assertComponentExist
### UiDriver.assertComponentExist
...
@@ -789,7 +866,10 @@ assertComponentExist(by:By):Promise<void>;
...
@@ -789,7 +866,10 @@ assertComponentExist(by:By):Promise<void>;
**示例:**
**示例:**
```
```
await assertComponentExist(By.text('next page'))
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
assertComponentExist
(
BY
.
text
(
'next page'
))
}
```
```
### UiDriver.pressBack
### UiDriver.pressBack
...
@@ -805,7 +885,10 @@ UiDriver对象进行点击BACK键的操作。
...
@@ -805,7 +885,10 @@ UiDriver对象进行点击BACK键的操作。
**示例:**
**示例:**
```
```
UiDriver.pressBack()
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
pressBack
()
}
```
```
### UiDriver.triggerKey
### UiDriver.triggerKey
...
@@ -827,7 +910,10 @@ UiDriver对象采取如下操作:通过key值找到对应键并点击。
...
@@ -827,7 +910,10 @@ UiDriver对象采取如下操作:通过key值找到对应键并点击。
**示例:**
**示例:**
```
```
await UiDriver.triggerKey(123)
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
triggerKey
(
123
)
}
```
```
### UiDriver.click
### UiDriver.click
...
@@ -849,7 +935,10 @@ UiDriver对象采取如下操作:在目标坐标点单击。
...
@@ -849,7 +935,10 @@ UiDriver对象采取如下操作:在目标坐标点单击。
**示例:**
**示例:**
```
```
await UiDriver.click(100,100)
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
click
(
100
,
100
)
}
```
```
### UiDriver.doubleClick
### UiDriver.doubleClick
...
@@ -871,7 +960,10 @@ UiDriver对象采取如下操作:在目标坐标点双击。
...
@@ -871,7 +960,10 @@ UiDriver对象采取如下操作:在目标坐标点双击。
**示例:**
**示例:**
```
```
await UiDriver.doubleClick(100,100)
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
doubleClick
(
100
,
100
)
}
```
```
### UiDriver.longClick
### UiDriver.longClick
...
@@ -893,7 +985,10 @@ UiDriver对象采取如下操作:在目标坐标点长按下鼠标左键。
...
@@ -893,7 +985,10 @@ UiDriver对象采取如下操作:在目标坐标点长按下鼠标左键。
**示例:**
**示例:**
```
```
await UiDriver.longClick(100,100)
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
longClick
(
100
,
100
)
}
```
```
### UiDriver.swipe
### UiDriver.swipe
...
@@ -916,7 +1011,10 @@ UiDriver对象采取如下操作:从给出的起始坐标点滑向给出的目
...
@@ -916,7 +1011,10 @@ UiDriver对象采取如下操作:从给出的起始坐标点滑向给出的目
**示例:**
**示例:**
```
```
await UiDriver.swipe(100,100,200,200)
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
swipe
(
100
,
100
,
200
,
200
)
}
```
```
### UiDriver.screenCap
### UiDriver.screenCap
...
@@ -938,6 +1036,9 @@ UiDriver对象采取如下操作:捕获当前屏幕,并保存为PNG格式的
...
@@ -938,6 +1036,9 @@ UiDriver对象采取如下操作:捕获当前屏幕,并保存为PNG格式的
**示例:**
**示例:**
```
```
await UiDriver.screenCap('/local/tmp/')
async
function
demo
()
{
let
driver
=
UiDriver
.
create
()
await
driver
.
screenCap
(
'/local/tmp/'
)
}
```
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录