Opening cmd with sikuli behaves unpredictable

320 views Asked by At

I'm trying to do some automated testing to the GUI of my software and to validate some stuff I need to compare exported files, for witch I use fc in command line.

I need the handle of my program and cmd in order to switch between them. Unfortunately Sikuli behaves very unpredictable when calling

cmd = App("cmd.exe") 

Sometimes it opens a new console and sometimes it focuses on the console already open from the sikuli IDE.

Is there a smarter and robust way to work with console and sikuli?

1

There are 1 answers

0
Eugene S On BEST ANSWER

Yes, App class can behave funny sometimes and is not 100% reliable. What you can do, is to avoid invoking the actual cmd windows which can by itself lead to confusion. Instead, you can run your actual cmd command from Sikuli script directly and read the output to a variable. For example:

output = run("cmd /C dir")

Then the output variable will contain the actual output of the dir command as if you'd run it from command line. So in your case:

output = run("cmd /C fc path1/file1 path2/file2")