CopyFromDevice Method

Applies to TestComplete 15.70, last modified on December 17, 2024
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

Use the CopyFromDevice method to copy the specified file from the connected Android device to a new location on your computer.

Declaration

FileSystemManagerObj.CopyFromDevice(PathOnTheDevice, PathOnTheHost)

FileSystemManagerObj An expression, variable or parameter that specifies a reference to a FileSystemManager object
PathOnTheDevice [in]    Required    String    
PathOnTheHost [in]    Required    String    
Result Boolean

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

PathOnTheDevice

Specifies the name (with the full path) of the file you want to copy from the device. Case-sensitive.

If the specified file does not exist on the device, the method posts a message to the test log informing you about the problem.

PathOnTheHost

Specifies the name (with the full path) of the file that will be created on the computer. If a file with the specified name already exists, it is replaced.

Result Value

True if the file has been copied successfully; False otherwise.

Example

The following example demonstrates how to copy the specified file from the connected Android device to a new location on your computer:

JavaScript, JScript

function Test()
{

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

  var pathOnDevice = "system/app/Orders.apk";
  var pathOnHost = "C:\\TestComplete Work Folder\\Orders.apk";

  fileSystemManager.CopyFromDevice(pathOnDevice, pathOnHost);

}

Python

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

  pathOnDevice = "system/app/Orders.apk"
  pathOnHost = "C:\\TestComplete Work Folder\\Orders.apk"
  
  fileSystemManager.CopyFromDevice(pathOnDevice, pathOnHost)

VBScript

Sub Test

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

  pathOnDevice = "system/app/Orders.apk"
  pathOnHost = "C:\TestComplete Work Folder\Orders.apk"

  Call fileSystemManager.CopyFromDevice(pathOnDevice, pathOnHost)

End Sub

DelphiScript

function Test();
var fileSystemManager, pathOnDevice, pathOnHost;
begin

  fileSystemManager := Mobile.Device('MyDevice').FileSystemManager;

  pathOnDevice := 'system/app/Orders.apk';
  pathOnHost := 'C:\TestComplete Work Folder\Orders.apk';

  fileSystemManager.CopyFromDevice(pathOnDevice, pathOnHost);

end;

C++Script, C#Script

function Test()
{

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

  var pathOnDevice = "system/app/Orders.apk";
  var pathOnHost = "C:\\TestComplete Work Folder\\Orders.apk";

  fileSystemManager["CopyFromDevice"](pathOnDevice, pathOnHost);

}

See Also

FileSystemManager Object
Testing Android Applications (Legacy)

Highlight search results