Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to get total number of links on a web page
#1
Not Solved
Hi all,
Can anybody please help me on this code.
Code:
Dim odesc
Set odesc = Description.Create
odesc("micclass").value="Browser"
odesc("title").value = "Welcome: Mercury Tours"
Set  odescp = Description.Create
odescp("micclass").value="Page"
odescp("tile").value= "Welcome: Mercury Tours"
Set odescL = Description.Create
odescL("micclass").value="Links"
Links=Browser(odesc).Page(odescp).ChildObjects(odescL)
MsgBox Links.count

When i am running the code i am getting this error.

General : Run time erro

Line (10):
Code:
"Links=Browser(odesc).Page(odescp).ChildObjects(odescL)".


Thanks,
Rgummadidala.
Reply
#2
Not Solved
Turn off the Regular Expression..

Code:
odescp("micclass").RegularExpression = False
Reply
#3
Not Solved
Might just be a typo but

Code:
odescL("micclass").value = "Link"
set Links = Browser(odesc).Page(odescp).ChildObjects(odescL)
Reply
#4
Not Solved
Hi,

Use the below code

Code:
Set Desc1=Description.Create()
Desc1("micClass").Value="Link"

Set Coll=Browser("title:=Google").Page("title:=Google").ChildObjects(Desc1)
MsgBox Coll.Count
Reply
#5
Not Solved
Hi All,

I have corrected the typo error "Links" in my code and now the code looks as below (this is taken from some other thread in this forum)

Code:
Set oBrowserDescriptions = Description.Create ()
oBrowserDescriptions("micClass").Value = "Browser"
oBrowserDescriptions("openedbytestingtool").Value = "True"

Browser(oBrowserDescriptions).Exist()

Set oPageDescriptions = Description.Create ()
oPageDescriptions("micClass").Value = "Page"
Set oBrowserObj = Browser(oBrowserDescriptions).Page(oPageDescriptions)

Systemutil.Run "iexplore"
Browser(oBrowserDescriptions).Navigate("http://www.yahoo.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


When I ran this, it is failing when invoking some method on "Browser" object like "Browser(oBrowserDescriptions).Exist()" or "Browser(oBrowserDescriptions).Navigate("http://www.yahoo.com" )", as if some kind of NullPointerException in java or some other language. The exact error message I see here is

Cannot identify the object "[ Browser ]" (of class Browser). Verify that this object's properties match an object currently displayed in your application.

Line (8):
Code:
"Browser(oBrowserDescriptions).ClearCache".


From the error, it appears as if Browser object was not created. Do I need to create the Browser object explicitly or for that matter, how does this work in Descriptive Program. Many examples which I saw in other posts and forums, the skeleton remains the same as above, but some how it is failing or apparently I'm missing something here.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Can QTP handle slick grid table in a web page qtplearner88 2 4,479 10-01-2019, 10:44 AM
Last Post: shilpi952
  unable to rowcount in web table manoj84monu 1 2,887 06-13-2016, 04:46 PM
Last Post: Anu1234
  DP Web Browser/Page issues rstimers 1 2,420 08-14-2015, 12:37 PM
Last Post: venkatesh9032
  I want to click on all the links in the webtable. These links are nothing but some co abhideshpande001 0 2,644 07-22-2015, 09:36 AM
Last Post: abhideshpande001
  Fetching total number of records inside a webtable vidya2k2 2 3,855 06-15-2015, 02:55 PM
Last Post: venkatesh9032

Forum Jump:


Users browsing this thread: 1 Guest(s)