Wednesday, July 21, 2010

Find a Cell with Specified Text and Click It

Description
Returns the number of the first row found that contains a cell with the specified text.


Syntax
object.GetRowWithCellText (Text, [Column], [StartFromRow])

Argument Description
object A test object of type WebTable.
Text Required. A String value. The text string for which to search.
Column Optional. A Variant value. The column number where the cell is located. The value can either be the column name or index. Index values begin with 1.
StartFromRow Optional. A Long value. The number of the row in which to start the search. The first row in the table is numbered 1.

Return Value
A Long value.

Sub GetRowWithCellText_Example()

'The following example uses the GetRowWithCellText method to

'find the row in the "OutboundFlights" table that contains the

'text "Price" and then find the cell in that row that contains

'a link and click it.



row = Browser("Mercury Tours").Page("Search Results").WebTable("OutboundFlights").GetRowWithCellText("Price", 2, 2)

Set Link = Browser("Mercury Tours").Page("Search Results").WebTable("OutboundFlights").ChildItem(row, 2, "Link", 0)

Link.Click



End Sub

No comments:

Post a Comment