[英]How to click a particular Row in WpfCalendar of Flights Reservation Application in UFT
As per need, I want to select the Second Row from FlightsGrid Image shown below. 根据需要,我想从下面显示的FlightsGrid图像中选择“第二行”。 Applying below Code, I am getting RowCount as 6 but not able to click on 3rd Row. 应用下面的代码,我将RowCount设置为6,但无法单击第三行。
Set ODesc = Description.Create
oDesc("micclass").value = "WpfTable"
Set objchild = WpfWindow("HPMyFlightSampleApplication").WpfTable("Table_FlightsGrid")
objCount = objchild.rowcount
objCount(2).click
Image from Flight Reservation Application: 来自航班预订应用程序的图像:
First, why are you using DP here if you are able to get row count of table. 首先,如果能够获取表的行数,为什么在这里使用DP。 Following two lines will give you row count of the table: 以下两行将为您提供表的行数:
Set objchild = WpfWindow("HPMyFlightSampleApplication").WpfTable("Table_FlightsGrid")
objCount = objchild.rowcount
Second, try using its SelectRow method to select required row. 其次,尝试使用其SelectRow方法选择所需的行。
As @Motti suggested, you can use SelectRow
. 如@Motti所建议,您可以使用SelectRow
。 Or if you want to go more in depth and want to select particular cell (which will eventually select the entire row), you can use SelectCell
like this way: 或者,如果您想更深入地选择特定的单元格(最终将选择整个行),则可以像下面这样使用SelectCell
:
'Rows and Columns indexes are 0-based
iCols = WpfWindow("devname:=HPE MyFlight Sample Application").WpfTable("devname:=flightsDataGrid").ColumnCount
iRows = WpfWindow("devname:=HPE MyFlight Sample Application").WpfTable("devname:=flightsDataGrid").RowCount
sFlightNum = "12274 NW"
For i = 0 To iRows
If WpfWindow("devname:=HPE MyFlight Sample Application").WpfTable("devname:=flightsDataGrid").GetCellData(i, 4) = sFlightNum Then
WpfWindow("devname:=HPE MyFlight Sample Application").WpfTable("devname:=flightsDataGrid").SelectCell i, 4
Exit For
End If
Next
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.