Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Object Required Error
#1
Hi
I am having the problem for Object Required Error.
I want to increment the index property for WebElement,For index property "0" it is doing good. While i am increment the index property it says object required. The below code is used for this.

Code:
l=0 Do while Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").ChildItem(a_rows, a_cols, "WebElement", l).Exist(5) Set objChildItem = Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").ChildItem(a_rows, a_cols, "WebElement",l) objChildItem.Click l = l+1 Loop

Please Can anyone tell me the solution for this.

Regards,
Ranjit Kumar.B
Reply
#2
Hi,

If u are having only one webelement in the cell, don't iterate the index property in childitem, as it will search for that particular indexed webelement in that cell and not finding any, it will return an error.

Just put it as 0 & try.

Let me know if any info. is needed.

Regards
Reply
#3
Hi anil,

Thankyou for your reply,
For "0" it is working,But in my webtable 5 rows and for every row one element is there.i want to click on each webElement in each row.

Thanks & Regards,
Ranjit Kumar.B
Reply
#4
Hi,
U have 5 rows in ur webtable , so intead of increasing the index number try to increment the row and check if same coulmn is used

try something like this:

Code:
Do while Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").ChildItem(I, a_cols, "WebElement", 0).Exist(5) Set objChildItem = Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").ChildItem(I, a_cols, "WebElement",0) objChildItem.Click l = l+1 Loop


I am assuming that weblement is present in same column no. for each row.U can increment the index when more than one item present in same cell.

Let me know for more clarifications

Regards,
Sankalp
Reply
#5
Hi Sankalp,
I am sending the Screenshot of my web table, in that last column i circled it. For that link i am trying to put the Index property. But it is not working.

I am doing following code for row and column count and also the cell data.
Code:
If Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").Exist(5) Then a_rows = Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").GetROProperty("rows") a_cols = Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").GetROProperty("cols") l = 0 For i = 1 to a_rows For j = 1 to a_cols If Browser( "Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").Exist(20)Then a_celldata = Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").GetCellData(i,j) End If If a_celldata = "Details" Then Do while Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").ChildItem(a_rows, a_cols, "WebElement", l).Exist(5) Set objChildItem = Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").ChildItem(a_rows, a_cols, "WebElement",l) objChildItem.Click l = l+1 Loop Next Next End If


Attached Files Image(s)
   
Reply
#6
Hi ,
By looking at ur screen shot it looks like column remains same.
Try below script and let us know the result

Code:
If Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").Exist(5) Then a_rows = Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").GetROProperty("rows") For r = 1 to a_rows a_celldata = Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").GetCellData(i,j) If a_celldata = "Details" Then Set objChildItem = Browser("Browser").Page("ShipmentLink - Sailing_2").WebTable("Seq_2").ChildItem(r, 11, "WebElement",l) objChildItem.Click End If Next Else Msgbox "Required Table does not exists" End If
Reply
#7
Hi,
Thank you for your reply,

The code is perfectly working.
Thanks alot.

Regards,
Ranjit Kumar.B
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  General Object Error(Find Object Error) akhandesh 1 4,152 02-24-2016, 01:05 PM
Last Post: sindhus
  Script required to run any app as administrator kalyan_srirangam 0 3,087 09-02-2013, 08:18 PM
Last Post: kalyan_srirangam
  Error while creating object using description.create object in VB script SarodeGirish 5 7,215 06-19-2012, 05:30 PM
Last Post: ssvali
  Object Required Error rohit330 0 3,208 05-07-2012, 10:16 PM
Last Post: rohit330
  Error: The systemcannot locate the object specified happened alin 3 6,061 12-16-2011, 02:52 PM
Last Post: alin

Forum Jump:


Users browsing this thread: 1 Guest(s)