Micro Focus QTP (UFT) Forums
Dynamic Link which opens in new window Help - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Dynamic Link which opens in new window Help (/Thread-Dynamic-Link-which-opens-in-new-window-Help)



Dynamic Link which opens in new window Help - starscream - 08-07-2011

Hi,

I want to automate clicking on a dynamic link(Comments) which opens a new browser window...For some reason even though QTP recognizes the object, it doesn't open the comments in a new window

Here's the code:
Code:
' Create description for all Links on a Web page.
' For that we use "html tag" property and its value "A"
Set descLink = Description.Create
descLink("html tag").value = "A"
descLink("text").value= "0 Comments"

' Get all Links which match the above description
Set listLinks = Browser("abcd").Page("abcd").ChildObjects(descLink)

While (listLinks.Count =0)
wait(3)

Browser("abcd").Refresh
Wend
If (listLinks.Count =1) Then
wait(4)


If (listLinks(0).exist) Then



listLinks(0).Click

End If
End If



RE: Dynamic Link which opens in new window Help - Tarik Sheth - 08-07-2011

Hi,

I do not see any code for entering the comments.

Code:
If (listLinks(0).exist) Then

[b]Browser("abcd").Page("pqrs").listLinks.set "xyza"[/b]

listLinks(0).Click

End If



RE: Dynamic Link which opens in new window Help - starscream - 08-09-2011

Huh? It's a link in a browser page and I want to click on it - Which should result in a new window being opened but it's not happening

To be clear, "0 comments" is a an object of class Link


RE: Dynamic Link which opens in new window Help - hariraman.g - 08-09-2011

Hi,
Can u plz do a object spy on the link and share us the snapshot. And also try

Msgbox listLinks(0).exist

see whether u r getting a message as True.


RE: Dynamic Link which opens in new window Help - parminderdhiman84 - 08-09-2011

hi,

Could you please try the below description for weblink

Code:
Set descLink = Description.Create
descLink("micclass").value = "Link"
descLink("text").value= "0 Comments"

Regards,
Parminder


RE: Dynamic Link which opens in new window Help - starscream - 08-10-2011

Thanks for your suggestions

Msgbox listLinks(0).exist gives a true

I tried with descLink("micclass").Value="Link" - Same result

The problem as I understand is not object recognition. QTP recognizes the link object.

Problem is, when I manually click on the dynamic link, it opens a new browser window with comments in it. Kind of like a chat window. It's not happening when I use QTP to do the same
I object spied the link properties and here they are ,listed(I can't attach screenshot)

Class Name:Link
Html tag:A
href: http://abcd.com/# - I think this is the problem
url: http://abcd.com/#
text,innerhtml,innertext,name: 914 Comments - (This keeps changing as this a dynamic link)
outerhtml: <A
visible: True


RE: Dynamic Link which opens in new window Help - suresh vasu - 08-10-2011

Hi,

Before listLinks(0).Click
Put listLinks(0).Highlight and observer whether your link is getting higlighted or not, If yes Check is there something blocking your new window/popup.

Thanks,
Suresh.