Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
object required Error
#1
Not Solved
Hi All,
I'm getting Object Required error for the below mentioned code
Code:
For i = 1 to row_cnt
WorkspaceName = Browser("").Page("").Frame("").WebTable("").GetCellData(i,col_cnt)
    If trim(WorkspaceName) = trim(Workspace) Then
        Set Workspace_Chk = Browser("").Page("").Frame("").WebTable("").ChildItem(i,1,"WebCheckBox",0)
        Workspace_Chk.Click
      Exit For
End If
Next

I tried using Wait and object.INIT too but the problem still exist. I have declared the Varible and used Option Explict also in the begining. I'm using QTP 9.5

Thanks in advance for help
Lokesh
Reply
#2
Not Solved
At which instance are you getting the error? Is it validating the If clause?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Not Solved
I see two potential problems, without knowing exactly where it's blowing up as Basanth pointed out.

Our web tables aren't always consistent. i.e., just because row 1 has 6 columns that doesn't mean that row 5 also has 6 columns. I don't think HTML requires you to have the same number of <TD> tags in each row of a table. If table(row,col_cnt) doesn't exist, you'll get an error on the line that does "Trim(Workspace)". I think (but can't remember off the top of my head) that calling CellData(x,y) where x or y is out-of-bounds will result in a QTP error.

The other thing I see that could be a problem is if "Browser("").Page("").Frame("").WebTable("").ChildItem(i,1,"WebCheckBox",0)" doesn't exist. Then you'll get a null reference for "Workspace_Chk". In the next line, when you try to use "Workspace_Chk", you'll get an error. I suggest you do something like "if IsNull(Workspace_Chk) then" and log some error or exit the test.
Reply


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

Forum Jump:


Users browsing this thread: 1 Guest(s)