Micro Focus QTP (UFT) Forums
Link object not getting identified - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Regular Expressions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Regular-Expressions)
+--- Thread: Link object not getting identified (/Thread-Link-object-not-getting-identified)



Link object not getting identified - yogesh kancherla - 10-13-2012

hi, I want to identify a link object whose property values change at runtime.
Below is the link how it looks:
OFS-47013-X:BTFG6412-1
But the above link always starts with OFS. so can u help me with regular expression for the above. I am using descriptive programming in my test.
i have tried the below but its not working
Link("innertext:=OFS.*")
please help me here


RE: Link object not getting identified - sshukla12 - 10-15-2012

Hi,

Are there multiple link with this name format?.If yes, then kindly provide the complete details.

Regards,
Sankalp


RE: Link object not getting identified - harishshenoy - 10-15-2012

Hi if there are more than one link which starts from the 'OFS' then u need to use index of it or try to use any other properties which make the link unique.

u can use link("innertext:=OFS.*" , "index:=0").click

but it is not recommended to use 'index' , try to identify with any of the other properties like 'class' and 'html id'.

Thanks,
Harish


RE: Link object not getting identified - yogesh kancherla - 10-15-2012

Hi,
this is the only link which i will capture, but there are other link as well in that page which starts with some other alphabets or numbers.
Below are the properties of the link object which i am trying to use
Code:
"innertext:=OFS.*",
"html tag:=A",
"color:=#0000ff",
"background color:=#ffffff"

I tried with the above.

below are the other properties available
Code:
[b]text[/b]=OFS-47045-X:BTFG9093-1
innertext=OFS-47045-X:BTFG9093-1
[b]outertext[/b]=OFS-47045-X:BTFG9093-1
[b]name[/b]=OFS-47045-X:BTFG9093-1
[b]innerhtml[/b]=OFS-47045-X:BTFG9093-1
[b]outerhtml[/b]=<A href="/StubEMPUI/BusinessMessageEvent.do?type=detail&amp;msgIndex=0">OFS-47045-X:BTFG9093-1</A>
abs_x=132
abs_y=478

for the first four properties value start with OFS only
i cannot use abs values as they are changing in runtime. please suggest.

below is my code
Code:
Set Mybrowser3=browser("title:=BusinessMessageEvents","name:=BusinessMessageEvents").page("title:=BusinessMessageEvents")
var_ofskeyid=Mybrowser3.Link("innertext:=OFS.*","html tag:=A").GetROProperty("innertext")
Mybrowser3.Link("text:=Notifications","html tag:=A","name:=Notifications").Click

its not working..


RE: Link object not getting identified - sshukla12 - 10-16-2012

Hi,

Try to use below code:
Code:
var_ofskeyid=Mybrowser3.Link("name:=OFS.*","html tag:=A").GetROProperty("innertext")

One more thing , do u want to click this link only or some other link because below line of code
Code:
Mybrowser3.Link("text:=Notifications","html tag:=A","name:=Notifications").Click
is clicking something else?
Regards,
Sankalp


RE: Link object not getting identified - yogesh kancherla - 10-16-2012

yes it worked now. thanks alot. earlier, it was not clicking any other link as well.
thanks alot for your help.


RE: Link object not getting identified - sshukla12 - 10-16-2012

Glad to hear it worked for you. Smile

Regards,
Sankalp


RE: Link object not getting identified - newqtp - 02-08-2013

I am getting error at this line of code.
browser("opentitle:=.*").page("title:=.*).link("href:=www.yahoo.com/account") value after account keep changing, to make it work I need to use regular expression.
I have tried link("href:=www.yahoo.com.*") it throws error. Any suggestion?


RE: Link object not getting identified - vinod123 - 02-18-2013

you did not use full value of the innertext. Enter the full value of the innertext it will solve your problem