Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to get values of childItem of a webtable
#1
Solved: 10 Years, 8 Months, 3 Weeks ago Toungue 
hi everyone ,

i have an issue with WebTable.
one of the cell of my web table has a "WebEdit" object
And my requitment is to read the value of WebEdit object and display it using msgbox.

i tried following:
--------------------- cut from code------------------------------------
Code:
set  a =  Browser("B").Page("P").WebTable("WT:").ChildItem(2, 1, "WebEdit", 0)
b= a.GetROProperty("value")
msgbox b
-------------------- end of cut-----------------------------------------

when i run this script , I get error message " Object required a"
what must be the problem with above code?

MY OR contains following:

browser-->page-->webedit,webtable
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Caze,

Your code does not have any problem.
pls Check row and Column values.
verify webedit Exists at that Cell i.e Row,col

Kindly Verify

Thanks
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Caze,

How many "WebEdit" objects are embedded inside the cell of Table ?

If '2' WebEdit objects are there in Cell (2,1):
then 1st WebEdit object's "Index" would be '0'
2nd WebEdit object's "Index" would be '1'

Hint: You could use "ChildItemCount" method to know how many "WebEdit" Objects are embedded in a CELL.

Code:
msgbox Browser("B").Page("P").WebTable("WT:").ChildItemCount(2, 1, "WebEdit")
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Sreekanth,

below is Caze code statement


Code:
set a = Browser("B").Page("P").WebTable("WT:").ChildItem(2, 1, "WebEdit", 0)

he is passing Index as "0" no matter how many webedit objects are there in cell.
it will consider object with index 0 only.
Reply
#5
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Nilesh,

You didn't percieved my point of explaination in above post.

Fyi, There could be ' n ' number of objects of certain Type in a cell of table.

Suppose the WebEdit what caze is refering is in different index position other than "0" then even if you run the above code the same Error "Object required..." would be displayed.

Hence I was suggesting to find out the correct index of WebEdit obj & proceed with next operations on the WebEdit.

If there is only one WebEdit in cell (2,1), then above code is fine with index "0".

Hope you are clearSmile
Reply
#6
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Sreekanth,

Correct me if i am wrong.

As per QTP help topic :-Identifying an Object Using the Index Property
index ares assigned as per Class i.e object Type
so if you have four objects two webedit and two webbutton in single cell
the index will be
first webedit index =0
Second webedit index =1

first webElement index =0
Second webElement index =1

as per you thinking it would be like

first webElement index =0
Second webElement index =1
first webedit index =2
Second webedit index =3
which is false as per QTP help



so need not worry even if one webedit is there it will be of index 0,

other type of objects will also start from zero.

Thanks
Help Referance

While learning an object, QuickTest can assign a value to the test object's Index property to uniquely identify the object. The value is based on the order in which the object appears within the source code. The first occurrence is 0.

"Index property values are object-specific" . Therefore, if you use Index:=3 to describe a WebEdit test object, QuickTest searches for the fourth WebEdit object in the page. However, if you use Index:=3 to describe a WebElement object, QuickTest searches for the fourth Web object on the page—regardless of the type—because the WebElement object applies to all Web objects.
Reply
#7
Solved: 10 Years, 8 Months, 3 Weeks ago
hi

thanks to all , my problem got solved

--------------------- cut from code------------------------------------
Code:
set a = Browser("B").Page("P").WebTable("WT:").ChildItem(2, 1, "WebEdit", 0)
b= a.GetROProperty("value")
msgbox b
-------------------- end of cut-----------------------------------------

web table property "WT:" in the above code (Webtable("WT:")) was not matching with my OR .
i corrected it , and its working well.

But the Error message "Object required a" ,which i was getting, will really does not help a user (beginer) to solve this issue.
Reply
#8
Solved: 10 Years, 8 Months, 3 Weeks ago
Sreekanth let me know your understanding on this.
Reply
#9
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Nilesh,

Yep, i agree with what you have explained.

But for your comment "so need not worry even if one webedit is there it will be of index 0,"
No need of worry if one webedit is there , as it start from index 0. That is obvious.
But If there are more than one webedits(No other Object Types) then corresponding "Index" would be required for Returning the Objects & perform operations on them.

@Caze :Its good that you identified where it went wrong & solved it on your own.
Reply
#10
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi Friendz,

I am having the same problem, and i have still not got any solution.
Plz help!!
Below is the code snippet.
Code:
set a = Browser("A").Page("B").WebTable("C").WebTable("Item").ChildItem(2,2,"WebElement",0)
b = a.GetROProperty("value")
MsgBox b

On running this i am getting error as "Object required". But on running below code am getting proper cell value which i am looking for.
Code:
MsgBox Browser("Name:=CDD").Page("Title:=CDD").WebTable("name:=Refresh View").WebTable("name:=Ignore").GetCellData(2,2)

Attach is OR tree.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Link in a webtable in a webtable Soulwalker 1 2,683 07-19-2017, 01:44 PM
Last Post: Ankur
  Webtable actions are not getting recorded, but ObjectSpy is able to identify webtable sahilarora2000 2 3,616 06-13-2014, 04:27 PM
Last Post: vinod123
  Unable to read numeric values from WebTable into Datatable Akhila 2 4,453 11-26-2013, 03:43 PM
Last Post: Akhila
  Webtable().GetCellData() Returns hidden values of Cells ssvali 4 5,657 06-07-2013, 08:37 PM
Last Post: kawsar
  How to compare local sheet values with run time data table values? test71 2 8,125 03-14-2008, 07:09 PM
Last Post: test71

Forum Jump:


Users browsing this thread: 1 Guest(s)