sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #04289
Re: [Question #165336]: Script runs with 100% CPU
Question #165336 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/165336
Status: Open => Answered
RaiMan proposed the following answer:
Since I do not have a WinXP system available currently, I made a test on
2GB system running Win7 32Bit.
this is the script:
# start chrome and wait for some window
chrx = r"C:\Users\Raimund Hocke\AppData\Local\Google\Chrome\Application\chrome.exe"
chra = App(chrx)
chra.focus()
while not chra.window():
wait(1)
# get the visible browser window
for i in range(100):
chrw = chra.window(i)
if not chrw: break
if chrw.w < 200 or chrw.h < 200: continue
chrw.highlight(2)
break
# open the sikuli homepage
type("l", KEY_CTRL)
type("sikuli.org\n")
# wait for Sikuli page to come up
img = "sikuli-project.png" # the title in upper left corner
reg = chrw.above(1).below(90).below(200)
while not reg.exists(img, 0):
wait(0.5)
# scroll down the page until image gets visible
# it is the "twitter follow me" at the bottom of the page
img = "follow-me.png"
# restrict the search to the lower 100 px of the browser window
reg = chrw.below(1).above(100)
# with this loop Sikuli is constantly doing a search
while not reg.exists(img, 0):
type(Key.DOWN)
reg.getLastMatch().highlight(2) # we got it
--- my experiences
- chrome starts up normally
- during the searches to wait for some image, cpu usage of Sikuli is about 20% to 40%
--- One more thing:
If you run a script from command line (guessing you do that), the startup of Sikuli takes about 5 seconds. So in your virtual environment with 1GB, this might take up to 10 or more seconds and during this period (which is the startup of the JVM and the loading of the Sikuli classes and native modules) cpu usage might be as much as possible.
So you have to look at the CPU usage after the script has started to be processed.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.