Using TestComplete With Administrator Privileges

Applies to TestComplete 15.64, last modified on June 12, 2024

Privilege Level

Windows Vista, Windows 7, Windows Server 2008 and later Windows versions provide a new security level, which is higher than that in previous versions of Windows. In order to test applications on these Windows versions, TestComplete must have the same or higher privileges than those of the applications under test. However, some changes in the security model may cause the test engine to malfunction:

  • Even if you log in to Windows using an administrator account, the applications that you will execute will not necessarily have administrator rights.

  • When TestComplete is launched from a user account, it will not have access to some application processes, since administrator privileges are required for this.

  • Even if TestComplete and your tested application are running under the same user account, they may have different security permissions under Windows 7, Windows Server 2008 R2 or later Windows versions. TestComplete can only “see” and interact with an application if it has the same or a higher level of security permissions than the application. For example, if TestComplete is run with user permissions and a tested application is run with administrator permissions, TestComplete will not be able to see the application’s windows and controls and to obtain properties of the application’s process.

To test your application, TestComplete must have the same or higher privileges than the application you are testing has:

  • If the tested application has user privileges, TestComplete can have either user or administrator privileges.

  • If the tested application has administrator privileges, TestComplete must also have administrator privileges.

The next sections explain how you can launch applications with administrator permissions in Windows.

Launching TestComplete With Administrator Permissions

There are several ways to run TestComplete as an administrator:

  • Right-click the TestComplete shortcut and select Run as administrator from the context menu:

    Shortcut Context Menu

  • Modify the TestComplete shortcut properties to run it as an administrator:

    1. Right-click the shortcut and select Properties from the context menu.

    2. On the Shortcut tabbed page, click the Advanced button. The Advanced Properties dialog will appear.

    3. Select the Run as administrator check box and click OK.

    4. Close the shortcut properties.

    Now, every time you run TestComplete using this shortcut, you will run it as an administrator.

  • Modify the TestComplete.exe file properties to always run it as an administrator:

    1. Locate the TestComplete.exe file in Windows Explorer or other file manager:

    2. Right-click the file and select Properties from the context menu.

    3. Switch to the Compatibility tabbed page.

    4. Select the Run this program as an administrator check box and click OK.

    Now every time time you run TestComplete – whether via a shortcut, from command line or any other way – it will be run as administrator.

    When launched with the Compatibility > Run this program as an administrator option, TestComplete cannot recognize Edge as a web browser. If you need to test websites in Edge while running TestComplete as administrator, launch TestComplete using one of the other methods described above.

Disabling UAC Prompt

When you run an application with administrator privileges under Windows 7, Windows Server 2008 R2 or later Windows versions, Windows displays a dialog box asking for your permission for the run. Due to certain limitations, the closing of this dialog box cannot be automated: when this dialog box is visible, the script run is automatically paused. So, you should close the dialog box manually or modify User Account Control settings so that Windows does not display the dialog. Note, however, that modifying the settings will impair the security:

  • Open Control Panel by clicking Start and then clicking Control Panel.

  • In the search box, type User Accounts and then select the User Accounts applet.

  • In the User Accounts window, click Turn User Account Control on or off.

    Windows will display a dialog box asking for your permission to continue. Click Continue in the dialog.

  • Clear the Use User Account Control (UAC) to help protect your computer check box and press OK.

  • Close the User Accounts window.

  • Restart your computer.

From now on, Windows will not display confirmation dialogs when you launch an application with administrator privileges. Note once again that changing the settings in the described way will impair the security.

Launching Tested Applications

You can launch a tested application with administrator permissions in the same manner that was described in the previous section. Note, however, that when a tested application is launched from TestComplete, the application will automatically gain the same privilege level as TestComplete. So if you call the tested application from the context menu of the TestedApps project item or by calling the TestedApps.RunAll or TestedApp.Run method in your script or the Run Tested App operation in your keyword tests, you do not need to modify the application’s properties.

TestComplete Features That Require Administrator Permissions

Using some of the testing features requires that TestComplete have administrator permissions:

See Also

Configuring Your System
TestComplete and Windows Firewall

Highlight search results