how to get values of childItem of a webtable - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: how to get values of childItem of a webtable (/Thread-how-to-get-values-of-childItem-of-a-webtable) Pages:
1
2
|
how to get values of childItem of a webtable - caze - 12-09-2009 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) 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 RE: how to get values of childItem of a webtable - nil - 12-09-2009 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 RE: how to get values of childItem of a webtable - sreekanth chilam - 12-09-2009 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") RE: how to get values of childItem of a webtable - nil - 12-09-2009 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. RE: how to get values of childItem of a webtable - sreekanth chilam - 12-09-2009 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 clear RE: how to get values of childItem of a webtable - nil - 12-09-2009 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. RE: how to get values of childItem of a webtable - caze - 12-09-2009 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) 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. RE: how to get values of childItem of a webtable - nil - 12-09-2009 Sreekanth let me know your understanding on this. RE: how to get values of childItem of a webtable - sreekanth chilam - 12-09-2009 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. RE: how to get values of childItem of a webtable - zeeshanyshaikh - 02-23-2012 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) 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. |