Click on any Text in the application
my scenario is i want to click on any text in the application using QTP...is it possible?? bt i can do this by using gettextlocation in which i hav to give x,y coordinates, but without using x,y coordinates, how to achiev it? kindly help me
If you know the class of that text say Link or Button or something, then it can be possible.
Or else use GetTextLocation method in "TextUtil" utility object.
hi bro, without using x,y co ordinates, is it possible to click on any text in webpage
As Uday said, if you know the class of the object, you can do that using various methods. I suggest using "mercury.devicereplay"
for getTextLocation, you need not to specify x,y coordinates.
but you need to pass, left, right, top and bottom values. These are defaulted to -1.
Following is the sample example from help file:
The following example searches for the word Mercury within the entire screen and clicks it if the word is found.
l = -1
t = -1
r = -1
b = -1
Succeeded = TextUtil.GetTextLocation("16",0,l,t,r,b)
If Not Succeeded Then
MsgBox "Text not found"
x = (l+r) / 2
y = (t+b) / 2
Set dr = CreateObject("Mercury.DeviceReplay")
dr.MouseClick x, y, 0
I would be glad if you share any other method if you come across.
Is it the web application? Then it will be probably a webelement and you can recognize using OR and use click method.
If not,whether that text is click-able?
Do provide some screenshot/application type.
RSS Feed : Break To Make it Better
A Lazy person could be the best automation professional, if he is not lazy in implementing his ideas to reduce his work. ~Anand Tambey
thanks bro, as you suggested,it will work, but i dont want to x,y co ordinates, without this x,y co ordinates, is it possible to click any method
hi thanks for ur rply, yes its web application and its webelement only, i can use fireevent double click on text, this method will work out?
Two ways :
1. Using Object repository mode, if you are aware of the specific object to click (both class and properties)
2. Try Child objects , if you only know the class of object. Enumerate through the collection and click on the one you need.
Fireevent, click should serve your purpose depending on the obj type.
-- Here to Learn and share ---