Simulating Touch Action
To touch a clock control, use the Touch
or LongTouch
actions of the Android Clock
object that TestComplete associates with that control. These actions simulate a single short or long touch on the clock control. Here is the example of how to touch the clock control using these actions:
JavaScript, JScript
function Test()
{
// Select the Android device
Mobile.SetCurrent("MyDevice");
// Obtain the clock object
var p = Mobile.Device().Process("com.example.myapp");
var TextClock = p.RootLayout("").Layout("layoutTop").Layout("layout1").TextClock("textClock1");
// Touch the clock
TextClock.Touch();
}
Python
def Test():
# Select the Android device
Mobile.SetCurrent("MyDevice")
# Obtain the clock object
p = Mobile.Device().Process("com.example.myapp")
TextClock = p.RootLayout("").Layout("layoutTop").Layout("layout1").TextClock("textClock1")
# Touch the clock
TextClock.Touch()
VBScript
Sub Test()
' Select the Android device
Mobile.SetCurrent("MyDevice")
' Obtain the clock object
Set p = Mobile.Device.Process("com.example.myapp")
Set TextClock = p.RootLayout("").Layout("layoutTop").Layout("layout1").TextClock("textClock1")
' Touch the clock
TextClock.Touch
End Sub
DelphiScript
procedure Test();
var
p, TextClock;
begin
// Select the Android device
Mobile.SetCurrent('MyDevice');
// Obtain the clock object
p := Mobile.Device.Process('com.example.myapp');
TextClock := p.RootLayout('').Layout('layoutTop').Layout('layout1').TextClock('textClock1');
// Touch the clock
TextClock.Touch;
end;
C++Script, C#Script
function Test()
{
// Select the Android device
Mobile["SetCurrent"]("MyDevice");
// Obtain the clock object
var p = Mobile["Device"].Process("com.example.myapp");
var TextClock = p["RootLayout"]("")["Layout"]("layoutTop")["Layout"]("layout1")["TextClock"]("textClock1");
// Touch the clock
TextClock["Touch"]();
}
Simulating Actions From Keyword Tests
This topic explains how to simulate touch on the clock control in scripts. You can use the described method in keyword tests too. To do this, use the On-Screen Action or the Call Object Method operations.
See Also
Working With Android Clock Controls
Getting Clock Control's Time
Touch Action (Mobile Objects)
LongTouch Action (Android Objects)