Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Whether function can return number of links and their names in a web page
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Friends,

Whether function can return number of Links and their names in a web page. I have tried but I am getting error as "Wrong number of arguments or invalid property assignment"

Here is my code:
Code:
n=abc()

msgbox n.count

Public function abc()

Set linkdesc=description.Create
       linkdesc("micclass").value="Link"
Set objlink=browser("g").Page("g").ChildObjects(linkdesc)

  abc=objlink

End Function

Can you please share your ideas
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
Try the below code

Code:
oval=  lnkCount()
For j = lbound(oval) to ubound(oval)
    Print oval(j)
Next
Print "Total No . of Link" &  ubound(oval)

Function lnkCount()

   Set linkDesc = Description.Create
    linkDesc("micclass").value = "Link"
    Set lnk = Browser("g").Page("g").ChildObjects(linkDesc)
    For i = 0 to lnk.Count - 1
        ReDim Preserve lnkname(i)
        lnkname(i) = lnk(i).GetROProperty("name")
        
    Next
    lnkCount = lnkname
    
End Function
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
Thanks Ssvali, Its working fine.
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
Your approach is right.
Instead of using abc = objlink, you should have used
abc = objlink.count()

and in place of msgbox = n.count, you should use msgbox = n

below is the modified version of your code.

--
Code:
SystemUtil.Run "iexplore.exe", "google.com"
n=abc()

msgbox n

Public function abc()

Set linkdesc=description.Create
       linkdesc("micclass").value="Image"
Set objlink = Browser("Google").Page("Google").ChildObjects(linkdesc)
abc = objlink.Count()

End Function
--

hope this helps.

Thanks,
Elango
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Find the number of occurrences of each number present in a matrix. Kalai 2 3,347 03-30-2015, 11:28 PM
Last Post: gauravarora6611
  How to retrive the randomly number from the web page . ? njnirmal 10 8,074 10-08-2009, 11:50 AM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)