简体   繁体   English

如何使用UFT单击“ SwfObject”?

[英]How to click 'SwfObject' using UFT?

在此处输入图片说明

I want to click on a link [Link name is 'Settlement'] and there are number of links on that page. 我想单击一个链接[Link name is 'Settlement'] ,该页面上有许多链接。

NOTE: Object spy does not identify 'Settlement' as the link instead it consider as Explorer Bar. 注意:对象间谍没有将“解决”标识为链接,而是将其视为资源管理器栏。 When I take object spy on 'Settlement' text it highlights entire Explorer Bar due to which I am not able to get 'Settlement' specific properties. 当我监视“结算”文本时,它会突出显示整个资源管理器栏,因此我无法获得“结算”特定的属性。 [refer attached screen shot. [请参阅随附的屏幕截图。 Due to security reason, I cannot upload a real screen shot]. 出于安全原因,我无法上传真实的屏幕截图]。

Through recording, I am able to click 'Settlement' link 通过录制,我可以单击“结算”链接

SwfWindow("Platform Integration Exchange").SwfObject("mainExplorerBar").Click 133,598

Currently, 133 & 598 are hard coded value for 'Settlement' but in future 'Settlement' position may change. 当前,133和598是“结算”的硬编码值,但将来“结算”的位置可能会更改。

So I want to know, How can I click a 'settlement' link using X & Y co-ordinate where Object spy is not able to identify 'Settlement' link separately?. 因此,我想知道,如何使用X和Y坐标单击“解决”链接,而Object spy无法单独识别“解决”链接?

OR is there any other way to click these type of objects? 还是有其他方法可以单击这些类型的对象?

Thanks Onkar 谢谢恩卡

In such case I would recommend using a virtual button object. 在这种情况下,我建议使用虚拟按钮对象。

In your UFT, go to: 在您的UFT中,转到:

Tools > Virtual Object > New Virtual Object 工具>虚拟对象>新建虚拟对象

Choose "Button" and click "Mark Object" Button. 选择“按钮” ,然后单击“标记对象”按钮。 A cross hair cursor would appear and mark the object that you would like to map. 将会出现一个十字形光标并标记您要映射的对象。 Choose the area in the coorrdinates you would like to click. 在您要单击的坐标中选择区域。

When you are done, click "Next" . 完成后,单击“下一步”

Select the parent of the Virtual object and click "Next" . 选择虚拟对象的父对象,然后单击“下一步”

Name the button, for example, " myButton ", and name the collection in which you would like to store the virtual object and click "Finish" . 将按钮命名为“ myButton ”,并命名要在其中存储虚拟对象的集合,然后单击“完成”

You can now use the" myButton " button in your script: 现在,您可以在脚本中使用“ myButton ”按钮:

SwfWindow("Platform Integration Exchange").VirtualButton("myButton").Click

Use Insight Objects. 使用Insight对象。 In my Project We are using swf application. 在我的项目中,我们正在使用swf应用程序。 For a part in application it's not getting identified, though it's one of the main part of Application. 对于应用程序中的一部分,虽然它是应用程序的主要部分之一,但并未得到识别。 So we use Insight Object. 因此,我们使用Insight对象。 It works perfectly fine. 它工作得很好。

else 其他

You can use Click method only if separately identified as Swf Object 仅当单独标识为Swf对象时,才能使用Click方法

Syntax is : object.Click [X], [Y], [BUTTON] 语法为:object。单击[X],[Y],[BUTTON]

X,Y,BUTTON are optional. X,Y,BUTTON是可选的。 By default it's gonna Left Click. 默认情况下,它会左键单击。

X,Y are co-ordinates. X,Y是坐标。

If you wanna different buttons to be clicked then use following. 如果您想单击其他按钮,请使用以下命令。

0=micLeftBtn
1=micRightBtn
2=micMiddleBtn

For LeftClick : SwfWindow("Form1").SwfObject("Object1").Click 对于LeftClick: SwfWindow("Form1").SwfObject("Object1").Click
For Right Click : SwfWindow("Form1").SwfObject("Object1").Click 1,1,1 右键单击: SwfWindow("Form1").SwfObject("Object1").Click 1,1,1
For Middle Click: SwfWindow("Form1").SwfObject("Object1").Click 1,1,2 对于中间单击: SwfWindow("Form1").SwfObject("Object1").Click 1,1,2

I have the same problem with powerbuilder application and I use the below function. 我在powerbuilder应用程序中遇到同样的问题,并且使用以下功能。 I have modified it for your requirement 我已根据您的要求进行了修改

Public Function CLICKTEXTINSIDEOBJECT 公共功能CLICKTEXTINSIDEOBJECT

Dim OperatedObject
Dim X1, X2, Y1, Y2

X1=0
X2=0
Y1=0
Y2=0

'get the object
Set OperatedObject = SwfWindow("Platform Integration Exchange").SwfObject("mainExplorerBar")

'get the co-ordinates of the text to be clicked
OperatedObject.GetTextLocation "Settlement",X1,Y1,X2,Y2

''Check if the Co-ordinates are assigned
if ((X1 > 0) or (Y1 > 0)) then
    OperatedObject.Click (X1 + X2)/2, (Y1+Y2)/2
    CLICKTEXTINSIDEOBJECT = true
Else
    CLICKTEXTINSIDEOBJECT = false
End If

End Function 结束功能

Below is the description about the GetTextLocation object 以下是有关GetTextLocation对象的描述

http://uft-help.saas.hpe.com/en/14.00/UFT_Help/Subsystems/FunctionReference/Subsystems/OMRHelp/Content/WindowsForms/SWFPACKAGELib~SwfObject.html#GetTextLocation http://uft-help.saas.hpe.com/zh-CN/14.00/UFT_Help/Subsystems/FunctionReference/Subsystems/OMRHelp/Content/WindowsForms/SWFPACKAGELib~SwfObject.html#GetTextLocation

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM