# 测试框架子系统JS API变更 OpenHarmony 3.1 Release版本相较于OpenHarmony 3.0 LTS版本,测试框架子系统的API变更如下: ## 接口变更 | 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | |---|---|---|---| | ohos.uitest | UiDriver | screenCap(savePath:string):Promise\; | 新增 | | ohos.uitest | UiDriver | swipe(startx:number,starty:number,endx:number,endy:number):Promise\; | 新增 | | ohos.uitest | UiDriver | longClick(x:number,y:number):Promise\; | 新增 | | ohos.uitest | UiDriver | doubleClick(x:number,y:number):Promise\; | 新增 | | ohos.uitest | UiDriver | click(x:number,y:number):Promise\; | 新增 | | ohos.uitest | UiDriver | triggerKey(keyCode:number):Promise\; | 新增 | | ohos.uitest | UiDriver | pressBack():Promise\; | 新增 | | ohos.uitest | UiDriver | assertComponentExist(by:By):Promise\; | 新增 | | ohos.uitest | UiDriver | findComponents(by:By):Promise\>; | 新增 | | ohos.uitest | UiDriver | findComponent(by:By):Promise\; | 新增 | | ohos.uitest | UiDriver | delayMs(duration:number):Promise\; | 新增 | | ohos.uitest | UiDriver | static create():UiDriver; | 新增 | | ohos.uitest | UiComponent | scrollSearch(by:By):Promise\; | 新增 | | ohos.uitest | UiComponent | inputText(text: string):Promise\; | 新增 | | ohos.uitest | UiComponent | isSelected():Promise\; | 新增 | | ohos.uitest | UiComponent | isFocused():Promise\; | 新增 | | ohos.uitest | UiComponent | isEnabled():Promise\; | 新增 | | ohos.uitest | UiComponent | isScrollable():Promise\; | 新增 | | ohos.uitest | UiComponent | isClickable():Promise\; | 新增 | | ohos.uitest | UiComponent | getType():Promise\; | 新增 | | ohos.uitest | UiComponent | getText():Promise\; | 新增 | | ohos.uitest | UiComponent | getKey():Promise\; | 新增 | | ohos.uitest | UiComponent | getId():Promise\; | 新增 | | ohos.uitest | UiComponent | longClick():Promise\; | 新增 | | ohos.uitest | UiComponent | doubleClick():Promise\; | 新增 | | ohos.uitest | UiComponent | click():Promise\; | 新增 | | ohos.uitest | By | isAfter(by:By):By; | 新增 | | ohos.uitest | By | isBefore(by:By):By; | 新增 | | ohos.uitest | By | selected(b?:bool):By; | 新增 | | ohos.uitest | By | focused(b?:bool):By; | 新增 | | ohos.uitest | By | enabled(b?:bool):By; | 新增 | | ohos.uitest | By | scrollable(b?:bool):By; | 新增 | | ohos.uitest | By | clickable(b?:bool):By; | 新增 | | ohos.uitest | By | type(tp:string):By; | 新增 | | ohos.uitest | By | id(id:number):By; | 新增 | | ohos.uitest | By | key(key:string):By; | 新增 | | ohos.uitest | By | text(txt:string,pattern?:MatchPattern):By; | 新增 | | ohos.uitest | MatchPattern | ENDS_WITH = 3 | 新增 | | ohos.uitest | MatchPattern | STARTS_WITH = 2 | 新增 | | ohos.uitest | MatchPattern | CONTAINS = 1 | 新增 | | ohos.uitest | MatchPattern | EQUALS = 0 | 新增 |