Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
object required 'A' error
#1
Solved: 11 Years, 3 Months, 4 Weeks ago
hi all
i m getting this error while running this code


thanks
sia


Code:
A = Browser("Justdial").Page("Justdial").WebElement(DataTable("categories", dtGlobalSheet)).GetROProperty("innertext")
msgbox A
If A.Exist Then
    Reporter.ReportEvent micPass,"pass","category found 1"
    else
    Browser("qpr").Page("qpr").Link("2").Click
        If A.Exist Then
            Reporter.ReportEvent micPass,"pass","category found 2"
            else
            Browser("qpr").Page("qpr").Link("3").Click
                    If A.Exist Then
                        Reporter.ReportEvent micPass,"pass","category found 3"
                        else
                        Browser("qpr").Page("qpr").Link("4").Click
                            If A.Exist Then
                                Reporter.ReportEvent micPass,"pass","category found 4"
                                else
                                Browser("qpr").Page("qpr").Link("5").Click    
                                    If A.Exist Then
                                        Reporter.ReportEvent micPass,"pass","category found 5"
                                        else
                                        Reporter.ReportEvent micFail,"invalid","category not found"
                                    End If                                                        
                            End If
                    End If
            End If
End If
Reply
#2
Solved: 11 Years, 3 Months, 4 Weeks ago
@ Sia,

the below statement returns a string
Code:
A = Browser("Justdial").Page("Justdial").WebElement(DataTable("categories", dtGlobalSheet)).GetROProperty("innertext")

you can not check for the existance of the string using .Exist method. This can be used only for objects. Hence you are getting the error as object required for the statement.

If you want to check if the string found or not, you should use INstr function. Refere to qtp help.

Regards,
Ankesh
Reply
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
replace the code with

if not isempty(a) then
....
....
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Intermitent "Object not visible" error erodpr 5 3,524 01-14-2016, 10:55 AM
Last Post: vinod123
  Unable to identify "Authentication Required" Dialog shaunysj 2 3,212 08-04-2015, 12:55 PM
Last Post: venkatesh9032
  ERROR : Object reference not set to an instance of an object. Suyashxp 2 7,247 12-30-2014, 11:32 AM
Last Post: ursprasadp
  code required for the following scenarios krithikaachari 0 2,231 09-27-2014, 01:00 AM
Last Post: krithikaachari
  object required shipu 1 3,974 01-16-2014, 08:11 PM
Last Post: supputuri

Forum Jump:


Users browsing this thread: 1 Guest(s)