Determining the Minimum and Maximum Scroll Vew Positions

Applies to TestComplete 14.93, last modified on October 12, 2021
Getting the wMin and wMax Properties

To determine the minimum and maximum positions of a scroll view control, use the wMin and wMax properties. These properties define the possible minimum and maximum values of the scroll view control. The example below obtains the wMin and wMax properties and posts them to the log:

JavaScript, JScript

function Test()
{
  // Select the Android device
  Mobile.SetCurrent("MyDevice");
  
  // Obtain the SeekBar object
  var p = Mobile.Device().Process("com.example.myapp");
  var ScrollView = p.RootLayout("").Layout("layoutTop").Layout("layout1").ScrollView("VerticalScrollView1");
  
  // Get the SeekBar minimum and maximum positions
  var MinPosition = ScrollView.wMin;
  var MaxPosition = ScrollView.wMax;
   
  // Post the positions to the log
  Log.Message(MinPosition);
  Log.Message(MaxPosition);
}

Python

def Test():
  # Select the Android device
  Mobile.SetCurrent("MyDevice")
  
  # Obtain the SeekBar object
  p = Mobile.Device().Process("com.example.myapp")
  ScrollView = p.RootLayout("").Layout("layoutTop").Layout("layout1").ScrollView("VerticalScrollView1")
  
  # Get the SeekBar minimum and maximum positions
  MinPosition = ScrollView.wMin
  MaxPosition = ScrollView.wMax
   
  # Post the positions to the log
  Log.Message(MinPosition)
  Log.Message(MaxPosition)

VBScript

Sub Test()
  ' Select the Android device
  Mobile.SetCurrent("MyDevice")
  
  ' Obtain the SeekBar object
  Set p = Mobile.Device.Process("com.example.myapp")
  Set ScrollView = p.RootLayout("").Layout("layoutTop").Layout("layout1").ScrollView("VerticalScrollView1")
  
  ' Get the SeekBar minimum and maximum positions
  MinPosition = ScrollView.wMin
  MaxPosition = ScrollView.wMax
   
  ' Post the positions to the log
  Log.Message(MinPosition)
  Log.Message(MaxPosition)
End Sub

DelphiScript

procedure Test();
var
  p, ScrollView, MinPosition, MaxPosition : OleVariant;
begin
  // Select the Android device
  Mobile.SetCurrent('MyDevice');
  
  // Obtain the SeekBar object
  p := Mobile.Device.Process('com.example.myapp');
  ScrollView := p.RootLayout('').Layout('layoutTop').Layout('layout1').ScrollView('VerticalScrollView1');
  
  // Get the SeekBar minimum and maximum positions
  MinPosition := ScrollView.wMin;
  MaxPosition := ScrollView.wMax;
   
  // Post the positions to the log
  Log.Message(MinPosition);
  Log.Message(MaxPosition);
end;

C++Script, C#Script

function Test()
{
  // Select the Android device
  Mobile["SetCurrent"]("MyDevice");
  
  // Obtain the SeekBar object
  var p = Mobile["Device"]["Process"]("com.example.myapp");
  var ScrollView = p["RootLayout"]("")["Layout"]("layoutTop")["Layout"]("layout1")["ScrollView"]("VerticalScrollView1");
  
  // Get the SeekBar minimum and maximum positions
  var MinPosition = ScrollView["wMin"];
  var MaxPosition = ScrollView["wMax"];
   
  // Post the positions to the log
  Log["Message"](MinPosition);
  Log["Message"](MaxPosition);
}

Using From Keyword Testing

This topic explains how to get the minimum and maximum values of the scroll view control in scripts. You can use the described properties in keyword tests too. To do this, use the On-Screen Action or the Call Object Method operations.

See Also

Working With Android Scroll View Controls
Determining the Scroll View Position

Highlight search results