Saurabh Seth
Saurabh Seth

Reputation: 53

How to identify a Specific WebElement which is a child of WebTable in UFT

I have a WebTable, which has some WebElements. I want to verify the text of one of the WebElements and take action on it. Can you help, how to proceed on this?

Upvotes: 2

Views: 14064

Answers (2)

Motti
Motti

Reputation: 114695

As Vinoth said if you know which row and column the element is in you can use ChildItem.

Typically UFT flattens the elements (so that a WebElement in a WebTable will appear as the WebTables sibling if both are added to the repository. However something that many people do not know is that if you manually put an element under the WebTable (or any other element) then UFT will look for it under the parent object.

This means that you can describe the nested element and UFT will only look under the table and not in the rest of the page.

Browser("B").Page("P").WebTable("T").WebElement("innertext:=.*bla.*").Click

Upvotes: 3

vins
vins

Reputation: 15370

You can use ChildItem method of WebTable.

Set MyWebElement = Browser("CreationTime:=0").Page("micclass:=Page").Webtable("name=TableName").ChildItem(Row, Column, micclass, Index)
  • Row - Required. A long integer value. The row number where the cell is located. The first row in the table is numbered 1.
  • Column - Required. A long integer value. The column number where the cell is located. The first column in the table is numbered 1.
  • MicClass - Required. A String value. The object type.
  • Index - Required. A long integer value. The index of the object of type MicClass in the cell. This index indicates the desired element when there is more then one object of type MicClass in the cell. The first object has an index of 0.

MyWebElement is the element you wanted. You can access any methods/properties of WebElement. For ex, to click,

MyWebElement.Click 

Upvotes: 1

Related Questions