This property is available in legacy mobile tests that work with devices connected to the local computer. To learn how to simulate user actions in newer cloud-compatible mobile tests, see the Simulating user actions in tests section. |
Description
The wTabText
property returns the caption of the tabbed page specified by the Index parameter.
Declaration
TestObj.wTabText(Item)
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 | |||
Item | [in] | Required | Variant |
Applies To
The property is applied to the following object:
View Mode
To view this property in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.
Parameters
The property has the following parameter:
Item
Specifies the desired item. You can enter the item’s index (from 0) or its caption. The caption can contain asterisk (*) or question mark (?) wildcards or regular expressions. The asterisk (*) corresponds to a string of any length (including an empty string), the question mark corresponds to any single character (including none). To specify more complicated parts of a caption, use regular expressions.
The caption can be case-sensitive or case-insensitive depending on the value of the Use case-sensitive parameters project setting.
Property Value
A string holding the caption of the specified tabbed page or an empty string, if the specified page is not found.
Example
The following example demonstrates how to obtain the tab's caption and post it to the log:
JavaScript, JScript
function Test()
{
// Select the Android device
Mobile.SetCurrent("MyDevice");
// Obtain the TabHost object
var p = Mobile.Device().Process("com.example.myapp");
var TabHost = p.RootLayout("").Layout("layoutTop").TabHost("tabhost")
// Get the text of the first tab
var TabText = TabHost.wTabText(0);
// Post it to the log
Log.Message(TabText);
}
Python
def Test():
# Select the Android device
Mobile.SetCurrent("MyDevice")
# Obtain the TabHost object
p = Mobile.Device().Process("com.example.myapp")
TabHost = p.RootLayout("").Layout("layoutTop").TabHost("tabhost")
# Get the text of the first tab
TabText = TabHost.wTabText[0]
# Post it to the log
Log.Message(TabText)
VBScript
Sub Test()
Dim p, TabHost
' Select the Android device
Mobile.SetCurrent("MyDevice")
' Obtain the TabHost object
Set p = Mobile.Device.Process("com.example.myapp")
Set TabHost = p.RootLayout("").Layout("layoutTop").TabHost("tabhost")
' Get the text of the first tab
TabText = TabHost.wTabText(0)
' Post it to the log
Log.Message(TabText)
End Sub
DelphiScript
procedure Test();
var
p, TabHost, TabText : OleVariant;
begin
// Select the Android device
Mobile.SetCurrent('MyDevice');
// Obtain the TabHost object
p := Mobile.Device.Process('com.example.myapp');
TabHost := p.RootLayout('').Layout('layoutTop').TabHost('tabhost');
// Get the text of the first tab
TabText := TabHost.wTabText(0);
// Post it to the log
Log.Message(TabText);
end;
C++Script, C#Script
function Test()
{
// Select the Android device
Mobile["SetCurrent"]("MyDevice");
// Obtain the TabHost object
var p = Mobile["Device"].Process("com.example.myapp");
var TabHost = p["RootLayout"]("")["Layout"]("layoutTop")["TabHost"]("tabhost")
// Get the text of the first tab
var TabText = TabHost["wTabText"](0)
// Post it to the log
Log["Message"](TabText)
}
See Also
About Testing Android Applications (Legacy)
Getting Tab Pages' Captions
SetText Action (Mobile Controls)
Keys Action (Android Objects)