aswathy
aswathy

Reputation: 139

Robot framework AutoIt library showing no error, but not starting the application

Applications such as notepad or wordpad is not getting opened by the run command even after giving the entire path. The calculator is getting opened but no other program is getting opened. AutoIt is installed and working fine in my system. Program for calculator is also working fine, but no other applications seem to start. All of the runs show the test as pass though even if the application is not up.

I already tried full path and I tried another answer at Robot Framework AutoitLibrary run command does not fail but does not open the application

Run_Program
    RUN   SnippingTool.exe

Upvotes: 2

Views: 2439

Answers (1)

michael_heath
michael_heath

Reputation: 5372

Seems the Run method is implicitly applying the SW_HIDE for the Flag argument, in AutoItX.

In AutoIt, if you use the Default keyword, as the flag argument in the Run function, it hides the startup window using the flag of SW_HIDE. SW_HIDE is the default in AutoItX as well, as my testing shows.

So what appears to be result is that calc.exe ignores the SW_HIDE flag at startup while other programs such as notepad.exe may apply it. The programs do start and you can see in the Task Manager that they are running, yet the windows may be in a hidden state.

This is the test file opened with a Python X64 process:

*** Settings ***
Library   AutoItLibrary

*** Variables ***
${SW_MAXIMIZE}      3
${SW_SHOW}          5
${SW_MINIMIZE}      6
${SW_SHOWDEFAULT}  10

*** Test Cases ***
Run_Program
    Run   notepad.exe  ${EMPTY}  ${SW_SHOW}
    Wait For Active Window   Untitled - Notepad
    Send   Welcome To AutoIt!   1

The window of Notepad does show.

I am not sure if constants are already available, so I added some variables for use as the Flag argument of Run. All of the variables tested OK in testing the startup window state.

Note that the File System Redirector can affect paths on a x64 OS. A 32 bit process for i.e. can be redirected to SysWOW64 directory, instead of the System32 directory. On a x64 OS, SnippingTool.exe is in System32 for a x64 process to access, though is not in SysWOW64 for a redirected x86 process. SysNative is an alias that can avoid the redirection of the x86 process.

I am not aware wordpad.exe is in the OS PATH variable so you may need to use a full path to access. Run with argument of only wordpad.exe fails the test.

Upvotes: 1

Related Questions