Wednesday, July 8, 2015

WebTable object and ChildItem Method


WebEx training notes:
-          WebTable :  WebTable is the web class in the web application. It plays major role in Web Page because table has multiple rows and columns. It would be very difficult to find some cell( row or column) in a web page because it will be too much for the object repository to hold properties of all cells.


As it becomes unrealistic to find Web Table cells using object Repository(as it fills the OR), so we use ChildItem(<row>,<column>,<classname>,<index>) .


Set obj = Browser(“<name>”).Page(“<name>”).WebTable(“<name>”). ChildItem(<row>,<column>,<mic classname>,<index>)


Obj.Set “<text to be entered, if class is web Element>”


- Mostly used methods with WebTable
RowCount
ColumnCount(<Row Number>) --- gives the number of columns in that Row Number
GetCellData(1,1)
ChildItem



Miscelleneous:


- How to identify that which web element lies in which row and column.(having difficulty with mycontactform.com)  ---- Solved(but try this technique once)

Use the Exist method and if condition to find if the value is "Nothing".

And you could use  RowCount and ColumnCount methods to navigate to each element.

And you could set value to the each type of element, by using ChildItem(row1,col1,"WebCheckBox",0).set "ON"   '---sets all checks all checkboxes
ChildItemCount(row1,col1,"WebEdit",0).set "srikanth"  '----insert "srikanth" to all webedits

Use F12 in IE to find the tr,td details.

- How to get the syntax of each method in UFT -- Solved

You will get it from the help document UFT has in help menu. It clearly gives syntax and description of methods.

Scripts:

msgbox Browser("Sample Email Forms - myContact").Page("Sample Email Forms - myContact").WebTable("Send To: * Marketing Departmen").ChildItemCount   ----- this one throws error saying wrong arguments assignment  --- Solved

Yes because WebTable accepts only 4 methods RowCount, ColumnCount, GetCellData, ChildItem

Set obj = Browser("Sample Email Forms - myContact").Page("Sample Email Forms - myContact").WebTable("Send To: * Marketing Departmen").ChildObjects

MsgBox obj.Count  --- Solved
The above code does not work as ChildObjects method does not work with WebTable
Set obj = Browser("Sample Email Forms - myContact").Page("Sample Email Forms - myContact").WebTable("Send To: * Marketing Departmen").ChildObjects("WebCheckbox") --- throws error --- Solved
The above code does not work as ChildObjects method does not work with WebTable


-

No comments:

Post a Comment