CopyToDevice Method

Applies to TestComplete 15.65, last modified on June 25, 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.


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


FileSystemManagerObj.CopyToDevice(PathOnTheHost, PathOnTheDevice)

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

Applies To

The method is applied to the following object:


The method has the following parameters:


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

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


Specifies the location on the Android device to which the file will be copied. Case-sensitive.

Result Value

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


The sample code below demonstrates how to access the connected Android device’s file system and copy a file from the local computer to the device:

JavaScript, JScript

function Test()

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

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

  fileSystemManager.CopyToDevice(pathOnHost, pathOnDevice);



def Test():

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

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

  fileSystemManager.CopyToDevice(pathOnHost, pathOnDevice)


Sub Test

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

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

  Call fileSystemManager.CopyToDevice(pathOnHost, pathOnDevice)

End Sub


procedure Test();
var fileSystemManager, pathOnDevice, pathOnHost;

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

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

  fileSystemManager.CopyToDevice(pathOnHost, pathOnDevice);


C++Script, C#Script

function Test()

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

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

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


See Also

FileSystemManager Object
Testing Android Applications (Legacy)

Highlight search results