Launch AUT code samples (JavaScript SDK)

The following code samples show how to launch a desktop application using different parameter combinations. To used this capability, you must create an application allowlist file. For details, see Run desktop applications from the UFT Developer SDK.

Launch the calc application using its full path and then close the application.

it("Launch AUT with full path",function(done){
	LFT.Desktop.launchAut("C:\\Windows\\System32\\calc.exe").then(function(calc) {
		//your test code goes here
		calc.close();
		whenDone(done);
	});
});		

Launch the calc application using only its name.

it("Launch AUT using shortcut",function(done){
	LFT.Desktop.launchAut("calc").then(function(calc) {
		//your test code goes here
		calc.close();
		whenDone(done);
	});
});		

Launch notepad using its name and the file that you want to open.

it("Launch AUT with arguments",function(done){
	LFT.Desktop.launchAut("notepad", ["C:\\Temp\\1.txt"]).then(function(notepad) {
		//your test code goes here
		notepad.close();
		whenDone(done);
	});
});		

Launch notepad using two arguments: the file that you want to open and a notepad argument for opening the file in unicode, and the directory where the file resides.

it("Launch AUT with arguments and working directory",function(done){
	LFT.Desktop.launchAut("notepad", ["/w", "unicode.txt"], "C:\\Temp").then(function(notepad) {
		//your  test code goes here
		notepad.close();
		whenDone(done);
	});
});