sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #28539
Re: [Question #255249]: App.open fails. os.system opens the app but no button is working on app probably cause of not in focus
Question #255249 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/255249
Description changed to:
Hi
I am quite new to Sikuli and I am using it to automate couple of windows benchmark tools (like CDM,AS SSD, HDTunePro).
I have successfully automated it for CDM and it works very fine . The problem is with AS SSD and HDTunePro.
In AS SSD, App.open fails even after giving the complete path of the executable. So I had to use os.system which succeeds but no operations are performed once it opens the app. Below is the code snippet
import shutil
import os
iter=input("Please enter how many iterations you want:\n(Default is 4)","4")
for n in range(int(iter)):
# asd=App.open("D:\\Program Files\\ASSSDBenchmark\\ASSSDBenchmark.exe") //fails with log [error] App.open failed: D:\Program Files\ASSSDBenchmark\ASSSDBenchmark.exe not found
# wait(2)
asd=r'"D:\Program Files\ASSSDBenchmark\ASSSDBenchmark.exe"'
asssd=App(asd)
if not asssd.window():
os.system(asd)
wait(2)
click("1412168323505.png") // no code working after this line. App opens and waits forever. After closing app manually, below log message :
[debug] getWindow: null
[error] script [ AS_SSD ] stopped with error in line 12
[error] FindFailed ( can not find 1412168323505.png on the screen. )
type("E"+Key.Enter)
click("1412168374882.png")
wait("1412168807440.png",300)
type("c",KEY_CTRL)
f=open("D:\\Users\\Test\\Desktop\\SikuliResultsASSSD.txt","a ")
result=Env.getClipboard()
f.write(result)
f.close()
# asd.close()
click("1412168833144.png")
With HDTunePro, same case for App.open() failure. One more issue is that
it is unable to open the app using os.system too, as first a popup is
displayed saying that it's a trial version for 15 days and you have to
click "ok" to run the app. This popup is not coming using the script.
How to handle this popup and shift focus back to app after clicking
"ok". Code is:
hd=r'"D:\Program Files (x86)\HD Tune Pro\HDTunePro.exe"'
hdtunepro=App("hd")
if not hdtunepro.window():
import os
os.system(hd)
wait(2)
if exists("Pattern("1412155138836.png").similar(0.48)",20):
click("ok.png")
wait(2)
# hd.focus()
wait(2)
click("1410524882923.png")
wait(10)
wait("1410524965008.png",300)
type("c",KEY_CTRL)
f=open("D:\\Users\\Test\\Desktop\\SikuliResultsHD.txt","a")
result=Env.getClipboard()
f.write(result)
f.close()
# hd.close()
popup("HDTunePro tool has finished benchmarking.\n Please see the results in SikuliResultsHD.txt")
Please help.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.