Micro Focus QTP (UFT) Forums
qtp query ,pls help me - 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: UFT / QTP Regular Expressions (https://www.learnqtp.com/forums/Forum-UFT-QTP-Regular-Expressions)
+--- Thread: qtp query ,pls help me (/Thread-qtp-query-pls-help-me)



qtp query ,pls help me - umadevi - 02-12-2016

hello sir,
im facing problem with my code in qtp keyword driven frame work.

each time i run my script ,it throws an general run error and im unable to click on any links in web applications mainly with,

Set FindObject=obj(0)

 please help me to solve this, i have attached the code here,

Function FindObject(ObjectName)
   Set Desc=Description.Create

For ObjNumber=1 to DataTable.GetSheet("OR").GetRowCount
DataTable.GetSheet("OR").SetCurrentRow(ObjNumber)
If DataTable("name","OR")=ObjectName Then

If DataTable("micclass","OR")<>"" Then
Desc("micclass").value=DataTable("micclass","OR")
End If

    If DataTable("html_id","OR")<>"" Then
Desc("html id").Value=DataTable("html_id","OR")
End If

If DataTable("class","OR")<>"" Then
Desc("class").value=DataTable("class","OR")
End If

    If DataTable("innertext","OR")<>"" Then
Desc("innertext").Value=DataTable("innertext","OR")
End If

If DataTable("value","OR")<>"" Then
Desc("value").Value=DataTable("value","OR")
End If


    Set Obj=Browser("creationtime:=0").Page("title:=.*").ChildObjects(Desc)
    Set FindObject=Obj(0)

  End If
Next
End Function


RE: qtp query ,pls help me - vinod123 - 03-17-2016

Instead of Using it check this simple script
Code:
Set Des_Obj = Description.Create
Des_Obj("micclass").Value = "Link"
Set link_col = Browser("micclass:=Browser").Page("micclass:=Page").ChildObjects(Des_Obj)
a = link_col.count
For i = 0 to a-1
  tag = link_col(i).GetROProperty("name")
  href = link_col(i).GetROProperty("url")
  Browser("micclass:=Browser").Navigate href
  Reporter.ReportEvent 0, "Tag Details  " &href, "Link Status"
Next



RE: qtp query ,pls help me - vinod123 - 03-18-2016

Write the code of the QTP between code tags