Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get total links visible on a webpage
#1
Not Solved Question 
Hi,

I tried fetching all the links on a webpage using the following code.

Code:
Set oDesc = Description.Create()
    oDesc("micclass").Value = "Link"
    Set ChildCount = Browser("name:=.*").page("title:=.*").ChildObjects(oDesc)
    num = ChildCount.Count

But it returns me links which are even not visible on the page. I would like to get only a set of visible links on the current page.

I tried using the "Visible" property as well but it reruns 0 objects.
Reply
#2
Not Solved
Hi,

Try to find the "unique" property by comparing the visible link and non visible link using the getroproperty. Then specify the same in description.

--Rahul
Reply
#3
Not Solved
Hi,

describe below property too.

Code:
oDesc("Visible").Value = "True"

And now try to run and let me know if it does not solve your issue.
Thanks,
SUpputuri
Reply
#4
Not Solved
Hi, It returns 0 objects if set:

Code:
oDesc("Visible").Value = "True"

Sad
Reply
#5
Not Solved
Code:
Set oBrowserDescriptions = Description.Create ()
oBrowserDescriptions("micClass").Value = "Browser"
oBrowserDescriptions("openedbytestingtool").Value = "True"
Set oPageDescriptions = Description.Create ()
oPageDescriptions("micClass").Value = "Page"
Set oBrowserObj = Browser(oBrowserDescriptions).Page(oPageDescriptions)
Systemutil.Run "iexplore"
Browser(oBrowserDescriptions).Navigate "www.google.com"
oBrowserObj.Sync
Set oBowserChObj = oBrowserObj.ChildObjects(oLinkDescriptions)
Set oBowserChObj = oBrowserObj.ChildObjects()
iChObjCnt = oBowserChObj.Count -1
msgbox iChObjCnt
For iCount = 0 to iChObjCnt
    If  oBowserChObj(iCount).GetROProperty("micclass") = "Link" Then
        If  oBowserChObj(iCount).GetROProperty("visible") = true Then
    msgbox oBowserChObj(iCount).GetROProperty("name")
    End if
    End If
Next
Reply
#6
Not Solved
visible is boolean so use = True with no quotes

Code:
Set oDesc = Description.Create()
oDesc("micclass").value = "Link"
'oDesc("visible").Value = True
Set childCollection = Browser("Google").Page("Google").ChildObjects(oDesc)
num = childCollection.count

msgbox "number of links = " & num

s = ""
For i = 0 to num - 1
    var = childCollection.item(i).GetROProperty("innertext")
    var_2 = childCollection.item(i).GetROProperty("visible")
    var_all = var & ": " & var_2
    s = s & vbcrlf & var_all
Next

msgbox s

on 2012-02-16. there are 40 links. 21 links have visible = True
Run the code with visible active and not active.

hth,


Parke
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Capture All text from webpage and copy it... mpatra 3 5,261 07-25-2018, 05:33 PM
Last Post: vimlesh
  [UFT 12.52/VBScript] Test object exist, is visible and enabled before take an action sparkwanted 0 3,650 02-07-2017, 12:28 AM
Last Post: sparkwanted
  Reading XML Data from a WebPage shaan.mishra87@gmail.com 1 2,209 09-28-2016, 09:16 PM
Last Post: supputuri
  Using static descriptive programming how to count no. of objects on any webpage alpha1 4 6,989 08-11-2015, 08:48 PM
Last Post: kotaramamohana
  I want to click on all the links in the webtable. These links are nothing but some co abhideshpande001 0 2,658 07-22-2015, 09:36 AM
Last Post: abhideshpande001

Forum Jump:


Users browsing this thread: 4 Guest(s)