I want to click on a link [Link name is 'Settlement']
and there are number of links on that page.
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.
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?.
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:
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" .
You can now use the" myButton " button in your script:
SwfWindow("Platform Integration Exchange").VirtualButton("myButton").Click
Use Insight Objects. In my Project We are using swf application. 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. It works perfectly fine.
else
You can use Click method only if separately identified as Swf Object
Syntax is : object.Click [X], [Y], [BUTTON]
X,Y,BUTTON are optional. By default it's gonna Left Click.
X,Y are co-ordinates.
If you wanna different buttons to be clicked then use following.
0=micLeftBtn
1=micRightBtn
2=micMiddleBtn
For LeftClick : SwfWindow("Form1").SwfObject("Object1").Click
For Right Click : SwfWindow("Form1").SwfObject("Object1").Click 1,1,1
For Middle Click: SwfWindow("Form1").SwfObject("Object1").Click 1,1,2
I have the same problem with powerbuilder application and I use the below function. I have modified it for your requirement
Public Function 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.