Search code examples
qtphp-uft

Changing UFT working directory


I recently had a situation where the application under test was not installed in Program Files or Program Files (x86).

When I launched that application from UFT it complained about not being able to find a ddl file and in the error trace it seemed to be looking for that ddl file not in the application installation directory rather in the UFT installation directory.

The problem was how to change the working directory?


Solution

  • I found two ways to change the working directory.

    1. From the Record and Run settings.

      In the record and run settings dialog box give the application path and the working directory. When the application is launched UFT will refer to the correct working directory.

    2. Using Code to change working directory

    'Change working directory
        Set objWrkDir = CreateObject("wscript.Shell")
        objWrkDir.CurrentDirectory = "AUT install path" 
        'Launch application 
        SystemUtil.Run "AUT executable path"