Micro Focus QTP (UFT) Forums

Full Version: getting error while trying to check all the links in the webpage ???
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
based on search keyword in anysearch site say google ...
trying to retrieve the total number of links present in that webpage and Check all the links in that web page .

i have used the below code for this but getting error saying "expected expression" in line numbers 4,9,10,17,19
Code:
Browser("google").Page("google").WebEdit("what").Set "plumbers"
Browser("google").Page("google").Image("btnG").Click 32,22

   Set oDesc = Description.Create()
[b]  oDesc(”html tag”).Value = "A"[/b]
   Set rc = Browser("google").Page("google").ChildObjects(oDesc)
   lnknum = rc.Count()
For j =0 to lnknum-1
     Set rc = Browser("google").Page("google").ChildObjects(oDesc)
     [b]tag = rc(j).GetROProperty(”innertext”)[/b]
     [b]href = rc(j).GetROProperty(”href”)[/b]
     Browser("google").Page("google").link(""&tag).click
     Browser("google").navigate(href)
      Browser("google").Page(""&tag).Sync
     Browser("google").Back
'check if the navigated page is equivalent to targetted page
  [b]orgPage =Browser("google").GetROProperty(”innertext”)[/b]
  
If tag = orgPage Then
          [b]Reporter.ReportEvent 0, “Navigated To Correct Page”,""&tag 'Reports if correct [/b]
     else
          Reporter.ReportEvent 1,""&tag,""&orgPage
   End If

next



mainly i think line 4 is wrong ...
can anyone pls correct me ...

Thanks
Navya
mmhhh.. one question: sure of your double quotation marks?
I have tried to copy-paste your code on QTP, and the result for line 4 is:
oDesc( html tag ).Value = "A"
It seems that your italic double quotation marks are not seen correctly...
thank you very much ...
your clue has cleared all my errors...
Hello Stevol,

i was able to perform my desired actions by skipping exceptions occured in the below 2 lines of code .
exception occured is:"object not found in the object repository"(not sure how to overcome this)

Code:
Browser("DexKnows Homepage").Page("DexKnows Homepage").link(""&j).click
Browser("DexKnows Homepage").Page(""&tag).Sync


Please help me out in solving this???
i am not sure what should go in
Code:
browser("").Page("").link(???????????).click      ??

Thanks
Navya