RaiMan / SikuliX-2014

SikuliX version 1.1.2 (until February 2018)
http://sikulix.com
805 stars 235 forks source link

Error in App.open failed: C:/Program not found on Windows Machine #269

Open AnandSingh314 opened 7 years ago

AnandSingh314 commented 7 years ago

On Windows machine program/process will be in C:/Program Files (x86)/.... The absolute path could have space in between. The windows implementation of OSUtil class which is WinUtil class is causing issue since it is taking the full process same in a single string, & later separating the parameters with space separator logic.

I would suggest for taking the process/program name separately while creating the App object.

[debug] RunTimeAPI: loadLib: WinUtil.dll [debug] WinUtil.getApp: C:/Program Files (x86)/Cisco/Cisco AnyConnect Secure Mobility Client/vpnui.exe [debug] App.create: [-1:C:/Program] true [debug] WinUtil.getApp: C:/Program false [debug] WinUtil.getApp: C:/Program [debug] WinUtil.getApp: 10504 [error] App.open failed: C:/Program not found [debug] highlight R[139,395 433x394]@S(0)[0,0 1920x1080] E:Y, T:3.0 for 2.0 secs app.isValid() => false app.window() => null app.isRunning() => false app.getName() => C:/Program [debug] RunTimeAPI: final cleanup [debug] FileManager: deleteFileOrFolder:

glitchassassin commented 7 years ago

Does this work?

App('"C:/Program Files (x86)/Cisco/Cisco AnyConnect Secure Mobility Client/vpnui.exe"')
HelioGuilherme66 commented 7 years ago

This is how I start my app:

import subprocess
subprocess.Popen(["C:\\Program Files\\Internet Explorer\\iexplore.exe", "http://my.URL.under.test/"])
glitchassassin commented 7 years ago

You should be able to use:

t = App.open('"C:\\Program Files\\Internet Explorer\\iexplore.exe" http://my.URL.under.test/')

I think the general rule is "if it works on the command line, it should work with App.open()". In this case, put double quotes around the path/executable name so it's recognized as a single token.

RaiMan commented 7 years ago

I have to check. App should interpret the given string or even list/array of strings as Python's subprocess.Popen does it.