ScrollToPage Method (iOS Controls)

Applies to TestComplete 14.20, last modified on September 11, 2019

Description

The ScrollToPage action scrolls the control content to the page specified by its index.

Declaration

TestObj.ScrollToPage(Index)

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    
Result

Applies To

The method is applied to the following objects:

View Mode

This method is available in the Object Browser panel and in other panels and dialogs in both Basic and Advanced view modes.

Parameters

The method has the following parameter:

Index

A zero-based index of the target page.

Example

The sample script below opens the second page in the scroll view.

JavaScript, JScript

function Test()
{
  // Select the mobile device
  Mobile.SetCurrent("iPhone");
  // Obtain the ScrollView object
  var p = Mobile.Device().Process("SampleApp");
  var scrollview = p.Window().ScrollView();
  
  scrollview.ScrollToPage(1)
}

Python

def Test():
  # Select the mobile device
  Mobile.SetCurrent("iPhone")
  # Obtain the ScrollView object 
  p = Mobile.Device().Process("SampleApp")
  scrollview = p.Window().ScrollView() 
  
  scrollview.ScrollToPage(1)

VBScript

Sub Test()
  Dim p, scrollview
  ' Select the mobile device
  Mobile.SetCurrent("iPhone")
  ' Obtain the ScrollView object
  Set p = Mobile.Device.Process("SampleApp")
  Set scrollview = p.Window.ScrollView
  
  scrollview.ScrollToPage(1)
End Sub

DelphiScript

procedure Test();
var
  p, scrollview;
begin
  // Select the mobile device
  Mobile.SetCurrent('iPhone');
  // Obtain the ScrollView object
  p := Mobile.Device.Process('SampleApp');
  scrollview := p.Window.ScrollView;
  
  scrollview.ScrollToPage(1)
end;

C++Script, C#Script

function Test()
{
  // Select the mobile device
  Mobile["SetCurrent"]("iPhone");
  // Obtain the ScrollView object
  var p = Mobile["Device"].Process("SampleApp");
  var scrollview = p["Window"]()["ScrollView"]();
  
  scrollview["ScrollToPage"](1);
}

See Also

Testing iOS Applications
Working with ScrollView in Paging Mode
Working with Table View in Paging Mode
Working with Multiline Edit Controls in Paging Mode

Highlight search results