Description
Use the wSection
to get the name of the specified section of the control.
Declaration
TestObj.wSection(Index)
Read-Only Property | String |
TestObj | A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section | |||
Index | [in] | Required | Integer |
Applies To
The property is applied to the following object:
View Mode
This property is available in the Object Browser panel and in other panels and dialogs in both Basic and Advanced view modes.
Parameters
The property has the following parameter:
Index
Specifies the zero-based index of the desired section. The first section has the index 0, the second - 1, and so on. The index of the last row is wSectionCount - 1
.
Property Value
The name of the specified item.
Remarks
To obtain the item’s name, TestComplete uses the getText()
native method. If a child item does not support this method, the wSection
property returns an empty string.
Example
The following example gets the properties of all TableView items and posts them to the log:
JavaScript, JScript
function Test()
{
// Select the mobile device
Mobile.SetCurrent("MyMobileDevice");
// Obtain the TableView object
var p = Mobile.Device().Process("SampleApp");
var tableview = p.XFObject("MainPage", "").XFObject("Grid", "").XFObject("TableView");
for (var i = 0; i < tableview.wSectionCount; i++)
{
Log.Message(tableview.wSection(i));
Log.Message(tableview.wItemCount(i));
}
}
Python
def Test():
# Select the mobile device
Mobile.SetCurrent("MyMobileDevice")
# Obtain the TableView object
p = Mobile.Device().Process("SampleApp")
tableview = p.XFObject("MainPage", "").XFObject("Grid", "").XFObject("TableView")
for i in range (0, tableview.wSectionCount):
Log.Message(tableview.wSection[i])
Log.Message(tableview.wItemCount[i])
VBScript
Sub Test()
Dim p, tableview
' Select the mobile device
Mobile.SetCurrent("MyMobileDevice")
' Obtain the TableView object
Set p = Mobile.Device.Process("SampleApp")
Set tableview = p.XFObject("MainPage", "").XFObject("Grid", "").XFObject("TableView")
For i = 0 To tableview.wSectionCount - 1
Log.Message(tableview.wSection(i))
Log.Message(tableview.wItemCount(i))
Next
End Sub
DelphiScript
procedure Test();
var
p, tableview, i, n;
begin
// Select the mobile device
Mobile.SetCurrent('MyMobileDevice');
// Obtain the tableview object
p := Mobile.Device.Process('SampleApp');
tableview := p.XFObject('MainPage', '').XFObject('Grid', '').XFObject('TableView');
for i := 0 to tableview.wSectionCount - 1 do
begin
Log.Message(tableview.wSection(i));
Log.Message(tableview.wItemCount(i));
end;
end;
C++Script, C#Script
function Test()
{
// Select the mobile device
Mobile["SetCurrent"]("MyMobileDevice");
// Obtain the TableView object
var p = Mobile["Device"].Process("SampleApp");
var tableview = p["XFObject"]("MainPage", "")["XFObject"]("Grid", "")["XFObject"]("TableView");
for (var i = 0; i<tableview["wSectionCount"]; i++)
{
Log["Message"](tableview["wSection"](i));
Log["Message"](tableview["wItemCount"](i));
}
}
See Also
wSectionCount Property (Specific to Xamarin.Forms TableView Controls)
Xamarin.Forms Objects
Testing Xamarin.Forms Applications (Legacy)