AddTrustedLocation Method

Applies to TestComplete 14.30, last modified on November 21, 2019

Description

Adds the specified folder or file to the list of Flash player's trusted locations.

Declaration

FlashSettingsObj.AddTrustedLocation(Path)

FlashSettingsObj An expression, variable or parameter that specifies a reference to a FlashSettings object
Path [in]    Required    String    
Result None

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

Path

Specifies the path to the folder (or single file) to be added to the list of trusted locations.

Result Value

None.

Remarks

The list of trusted locations specified by TestComplete is stored in the smartbear.cfg file that resides in this folder: <System_Drive>\<Users>\<User_name>\AppData\Roaming\Macromedia\Flash Player\#Security\FlashPlayerTrust.

Note that this setting is user-specific, that is, every Windows user has his or her own list of trusted locations.

Example

The code below adds a folder and a single file to the list of trusted locations and posts the list of trusted locations to the test log; then remove a file from the list and posts the resulting list of trusted locations to the test log:

JavaScript, JScript

function FlashConfig()
{
  // Add a file and a folder to the list of trusted locations and post the list to the test log
  Options.FlashSettings.AddTrustedLocation("c:\\WorkFolder");
  Options.FlashSettings.AddTrustedLocation("c:\\FlashApp\\FlashApp.swf");
  Log.Message(Options.FlashSettings.FlashTrustedLocations);

  // Remove a file from the list of trusted locations and post the list to the test log
  Options.FlashSettings.RemoveTrustedLocation("c:\\FlashApp\\FlashApp.swf");
  Log.Message(Options.FlashSettings.FlashTrustedLocations);
}

Python

def FlashConfig():
  # Add a file and a folder to the list of trusted locations and post the list to the test log
  Options.FlashSettings.AddTrustedLocation("c:\\WorkFolder")
  Options.FlashSettings.AddTrustedLocation("c:\\FlashApp\\FlashApp.swf")
  Log.Message(Options.FlashSettings.FlashTrustedLocations)

  # Remove a file from the list of trusted locations and post the list to the test log
  Options.FlashSettings.RemoveTrustedLocation("c:\\FlashApp\\FlashApp.swf")
  Log.Message(Options.FlashSettings.FlashTrustedLocations)

VBScript

Sub FlashConfig()

  ' Add a file and a folder to the list of trusted locations and post the list to the test log
  Call Options.FlashSettings.AddTrustedLocation("c:\WorkFolder")
  Call Options.FlashSettings.AddTrustedLocation("c:\FlashApp\FlashApp.swf")
  Log.Message Options.FlashSettings.FlashTrustedLocations

  ' Remove a file from the list of trusted locations and post the list to the test log
  Call Options.FlashSettings.RemoveTrustedLocation("c:\FlashApp\FlashApp.swf")
  Log.Message Options.FlashSettings.FlashTrustedLocations

End Sub

DelphiScript

procedure FlashConfig();
begin
  // Add a file and a folder to the list of trusted locations and post the list to the test log
  Options.FlashSettings.AddTrustedLocation('c:\WorkFolder');
  Options.FlashSettings.AddTrustedLocation('c:\FlashApp\FlashApp.swf');
  Log.Message(Options.FlashSettings.FlashTrustedLocations);

  // Remove a file from the list of trusted locations and post the list to the test log
  Options.FlashSettings.RemoveTrustedLocation('c:\FlashApp\FlashApp.swf');
  Log.Message(Options.FlashSettings.FlashTrustedLocations);
end;

C++Script, C#Script

function FlashConfig()
{
  // Add a file and a folder to the list of trusted locations and post the list to the test log
  Options["FlashSettings"]["AddTrustedLocation"]("c:\\WorkFolder");
  Options["FlashSettings"]["AddTrustedLocation"]("c:\\FlashApp\\FlashApp.swf");
  Log["Message"](Options["FlashSettings"]["FlashTrustedLocations"]);

  // Remove a file from the list of trusted locations and post the list to the test log
  Options["FlashSettings"]["RemoveTrustedLocation"]("c:\\FlashApp\\FlashApp.swf");
  Log["Message"](Options["FlashSettings"]["FlashTrustedLocations"]);
}

See Also

FlashSettings Object Methods
FlashSettings Object
Project Properties - Flash/Flex Options
Testing Flash and Flex Applications with the Debug Version of Flash Player - Overview

Highlight search results