Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Object Required Error
#1
Solved: 10 Years, 9 Months ago
Hi Ankur,

My task is to enable a checkbox of a required link. I've written the below code for accomplishing it.

It worked well initially. Suddenly when i tried executing today it throws error at "workspace_chkbox.Click" and says "Object Required".

Im confused on this coz it worked well before. Kindly help me on this.
The code below is for you reference



Code:
Dim workspace_chkbox
col_cnt = Browser("NPDM").Page("ENOVIA").Frame("MainFrame").WebTable("WorkspaceTable").GetROProperty("cols")
row_cnt = Browser("NPDM").Page("ENOVIA").Frame("MainFrame").WebTable("WorkspaceTable").RowCount
For i = 1 to row_cnt
    Workspace_Check= Browser("NPDM").Page("ENOVIA").Frame("MainFrame").WebTable("WorkspaceTable").GetCellData(i,col_cnt)
    If trim(Workspace_Name) = trim(Workspace_Check)  Then
                Set workspace_chkbox = Browser("NPDM").Page("ENOVIA").Frame("MainFrame").WebTable("WorkspaceTable").childitem(i,1,"WebCheckBox",0)
                [b]workspace_chkbox.Click[/b]        Exit For
    End If
Next

Thanks in Advance!

Sharmila
Reply
#2
Solved: 10 Years, 9 Months ago
Hi Sharmila,

Always use "Option Explicit" as the first line of your code. This will throw error if there is any typo in variable name or if a variable is not defined. In your code you have used: Workspace_Check and workspace_chkbox. If Option Explicit is not there then both the variables are considered as one and the same.

Check if the position of webcheckbox has changed in your application.
Reply
#3
Solved: 10 Years, 9 Months ago
Manish -
That is not correct. Workspace_check and workspace_chkbox are different variables.
Option Explicit is a good suggestion.

Sharmila -
The issue is with regards to either a shift in the location of the object or index. One of the ways i can suggest is to use On Error Resume next.
Try this code,
Code:
Dim workspace_chkbox
On Error Resume Next
col_cnt = Browser("NPDM").Page("ENOVIA").Frame("MainFrame").WebTable("WorkspaceTable").GetROProperty("cols")
row_cnt = Browser("NPDM").Page("ENOVIA").Frame("MainFrame").WebTable("WorkspaceTable").RowCount
For i = 1 to row_cnt
Workspace_Check= Browser("NPDM").Page("ENOVIA").Frame("MainFrame").WebTable("WorkspaceTable").GetCellData(i,col_cnt)
If trim(Workspace_Name) = trim(Workspace_Check) Then
Set workspace_chkbox = Browser("NPDM").Page("ENOVIA").Frame("MainFrame").WebTable("WorkspaceTable").childitem(i,1,"WebCheckBox",0)
workspace_chkbox.Click
msgbox Err.Number & " Error Number"
Msgbox Err.Description & " Error Description"
Exit For
End If
Next
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
#4
Solved: 10 Years, 9 Months ago
Hi Manish,

I tried option explicit and now i find it works. Thank you so much for your suggestion

Sharmila

Reply


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

Forum Jump:


Users browsing this thread: 1 Guest(s)