我想使用用户描述性编程来识别chrome Web应用程序中的对象。但是我发现我的脚本可以在笔记本电脑上工作,但不能在远程桌面上工作。
请注意,Chrome,UFT chrome插件,UFT使用的是相同版本,并且已重置为出厂设置。两者都使用相同的对象存储库。
我尝试了很多次:
案例1:
On error resume next
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("class:=mat-
calendar-period-button mat-button").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("disabled:=0").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("height:=40").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("html tag:=BUTTON").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("innerhtml:=<span class=""mat-button-wrapper"">FRI JUN 21 2019<div class=""mat-calendar-arrow""></div></span><div class=""mat-button-ripple mat-ripple"" md-ripple="""" ng-reflect-trigger=""\[object HTMLButtonElement\]"" ng-reflect-centered=""false"" ng-reflect-disabled=""false""></div><div class=""mat-button-focus-overlay""></div>").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("acc_name:=Change to year view").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("innertext:=FRI JUN 21 2019").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("type:=submit").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("width:=148").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("name:=FRI JUN 21 2019").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("outerhtml:=<button class=""mat-calendar-period-button mat-button"" md-button="""" aria-label=""Change to year view""><span class=""mat-button-wrapper"">FRI JUN 21 2019<div class=""mat-calendar-arrow""></div></span><div class=""mat-button-ripple mat-ripple"" md-ripple="""" ng-reflect-trigger=""\[object HTMLButtonElement\]"" ng-reflect-centered=""false"" ng-reflect-disabled=""false""></div><div class=""mat-button-focus-overlay""></div></button>").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("outertext:=FRI JUN 21 2019").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("value:=FRI JUN 21 2019").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("width:=148").Click
Browser("Br_eServices").Page("Pg_Claimsubmission").WebButton("y:=398","x:=418").Click
On error goto 0
在VM中,所有脚本都说: “无法识别对象“ [WebButton]”(WebButton类)。 验证该对象的属性是否与您的应用程序中当前显示的对象匹配。”
案例2:
Browser("FWD").Page("FWD").WebButton("xpath:=//DIV[3]/DIV[2]/MD-DATEPICKER-CONTENT[1]/MD-CALENDAR[1]/DIV[1]/DIV[1]/BUTTON[1]","type:=submit").Click
笔记本电脑和VM均正常工作
案例3:使用对象存储库
Browser("FWD").Page("FWD").WebButton("Change to year view").Click
笔记本电脑和VM均正常工作
这是来自对象间谍的对象属性:
"Class Name:=WebButton",
"abs_x:=418",
"abs_y:=469",
"acc_name:=Change to year view",
"class:=mat-calendar-period-button mat-button",
"disabled:=0",
"height:=40",
"html id:=",
"html tag:=BUTTON",
"innerhtml:=<span class=""mat-button-wrapper"">FRI JUN 21 2019<div class=""mat-calendar-arrow""></div></span><div class=""mat-button-ripple mat-ripple"" md-ripple="""" ng-reflect-trigger=""\[object HTMLButtonElement\]"" ng-reflect-centered=""false"" ng-reflect-disabled=""false""></div><div class=""mat-button-focus-overlay""></div>",
"innertext:=FRI JUN 21 2019",
"name:=FRI JUN 21 2019",
"outerhtml:=<button class=""mat-calendar-period-button mat-button"" md-button="""" aria-label=""Change to year view""><span class=""mat-button-wrapper"">FRI JUN 21 2019<div class=""mat-calendar-arrow""></div></span><div class=""mat-button-ripple mat-ripple"" md-ripple="""" ng-reflect-trigger=""\[object HTMLButtonElement\]"" ng-reflect-centered=""false"" ng-reflect-disabled=""false""></div><div class=""mat-button-focus-overlay""></div></button>",
"outertext:=FRI JUN 21 2019",
"role:=",
"title:=",
"type:=submit",
"value:=FRI JUN 21 2019",
"visible:=True",
"width:=148",
"x:=418",
"xpath:=//DIV\[3\]/DIV\[2\]/MD-DATEPICKER-CONTENT\[1\]/MD-CALENDAR\[1\]/DIV\[1\]/DIV\[1\]/BUTTON\[1\]",
"y:=398"
我希望案例1在VM中也会成功。我的问题是:为什么失败?