AndroidFolder Object

Applies to TestComplete 15.46, last modified on January 09, 2023
The information below concerns legacy mobile tests that work with mobile devices connected to the local computer. For new mobile tests, we recommend using the newer cloud-compatible approach.

Description

The AndroidFolder object provides information about a folder stored on the connected Android device. To obtain the AndroidFolder object in tests, use the FindFolders method of the FileSystemManager or AndroidFolder object.

Members

Example

The following example searches the device for folders that contain the word sys in their name and posts information on the found folders to the test log:

JavaScript, JScript

function Test()
{
  var fileSystemManager = Mobile.Device("MyDevice").FileSystemManager;

  var folders = fileSystemManager.FindFolders("*sys*");
  if (folders.Count > 0)
  {
    while (folders.HasNext())
    {
      var folder = folders.Next();
      Log.Message(folder.Name);
    }

  }
  else
    Log.Warning("No folders were found.");

}

Python

def Test():
  fileSystemManager = Mobile.Device("MyDevice").FileSystemManager

  folders = fileSystemManager.FindFolders("*sys*")
  if folders.Count > 0:
    while folders.HasNext:
      folder = folders.Next
      Log.Message(folder.Name)
  else:
    Log.Warning("No folders were found.")

VBScript

Sub Test

  Set fileSystemManager = Mobile.Device("MyDevice").FileSystemManager

  Set folders = fileSystemManager.FindFolders("*sys*")
  If folders.Count > 0 Then
    While folders.HasNext
      Set folder = folders.Next
      Log.Message(folder.Name)
    Wend

  Else
    Log.Warning("No folders were found.")
  End If

End Sub

DelphiScript

procedure Test();
var fileSystemManager, folders, folder;
begin
  fileSystemManager := Mobile.Device('MyDevice').FileSystemManager;

  folders := fileSystemManager.FindFolders('*sys*');
  if folders.Count > 0 then
    begin
      while folders.HasNext do
      begin
        folder := folders.Next;
        Log.Message(folder.Name);
      end;

    end
  else
    Log.Warning('No folders were found.');

end;

C++Script, C#Script

function Test()
{
  var fileSystemManager = Mobile["Device"]("MyDevice")["FileSystemManager"];

  var folders = fileSystemManager["FindFolders"]("*sys*");
  if (folders["Count"] > 0)
  {
    while (folders["HasNext"]())
    {
      var folder = folders["Next"]();
      Log["Message"](folder["Name"]);
    }

  }
  else
    Log["Warning"]("No folders were found.");

}

See Also

FindFolders Method
FileSystemManager Object
AndroidDevice Object
Testing Android Applications (Legacy)

Highlight search results