← Back to team overview

sikuli-driver team mailing list archive

[Bug 1199882] Re: .observe quits before it should be finished

 

Thanks for testing and evaluating.
At least the observe has some quirks ;-)

Today I went through the observe implementation and added some features
and a better (LOL)  debug log.

It will be available with the service update 1.0.1 end July.

- in the handler function you can decide to repeat the onAppear when coming back from the handler
e.repeat(time)
a time value in seconds waits for the target to vanish again before searching again (default region.AutoWaitTimeout)
this repeated onAppear is of value when you run the observe in the background.
(not restricting to the first appear in the RC3 version may lead to fancy loops ;-)

- e.getCount() gives you a number how many times, the handler was
visited

- you can say e.stopObserver() instead of e.region.stopObserver()

--- different image sets
This is best done with some images.sikuli, that is imported and has images stored in variables with some naming conventions or other structures, that allow to select a set depending on the current runtime situation.

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/1199882

Title:
  .observe quits before it should be finished

Status in Sikuli:
  Fix Committed

Bug description:
  I'm trying to create a script that tests an installer. For some reason
  it quits about half way through even though I can't see any reason for
  it to. It runs up until after it sees and runs the "install_path_page"
  handler. Once it runs that handler, it quits with "[info] Exit code:
  0"

  This is running on Windows Server 2012 Standard using 64-bit Java
  1.7.0_25 and 64-bit Sikuli IDE 1.0.0 with the
  "SupplementalObserveOnlyOnce" update.

  After posting this as a question, RaiMan mentioned that it will stop
  if it has handled all the .onAppear images. I tried adding a new
  .onAppear image that would never show up. The script still behaves
  exactly the same.

  Here is what I have so far. I plan on having observe run forever
  eventually and have the last handler stop the observation:

  installer_path = 'C:\\Users\\Administrator\\Desktop\\my_windows_setup.exe'
  license_company = 'company'
  license_name = 'name'
  license_count = 1
  license_key = 'xxxxxxxxxxxxxxxxxxxxxxxx'
  postgres_password = 'xxxxxxx'

  def click_next():
      click("1373388849234.png")

  def intro_page(event):
      click_next()

  def eula_page(event):
      click(Pattern("1373388972249.png").targetOffset(-65,1))
      click_next()

  def license_page(event):
      type(license_company + Key.TAB)
      type(license_name + Key.TAB)
      type(str(license_count) + Key.TAB)
      type(license_key)
      click_next()

  def install_path_page(event):
      click_next()

  def features_page(event):
      click_next()

  def postgresql_path_page(event):
      click_next()

  def postgresql_password_page(event):
      type(postgres_password + Key.TAB)
      type(postgres_password)
      click_next()

  def web_ports_page(event):
      click_next()

  def ready_to_install_page(event):
      click_next()

  def begin_watching():
      es_installer = App(installer_path)
      es_installer.open()
      wait("1373389889359.png", FOREVER)

      reg = Region(App('Setup').window(0))
      reg.onAppear("1373389041327.png", intro_page)
      reg.onAppear("1373389063530.png", eula_page)
      reg.onAppear("1373389092077.png", license_page)
      reg.onAppear("1373390507593.png", install_path_page)
      reg.onAppear("1373392574702.png", features_page)
      reg.onAppear("1373390778484.png", postgresql_path_page)
      reg.onAppear("1373391295577.png", postgresql_password_page)
      reg.onAppear("1373391322733.png", web_ports_page)
      reg.onAppear("1373391349515.png", ready_to_install_page)
      reg.observe(600)

  begin_watching()

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/1199882/+subscriptions


References