← Back to team overview

sikuli-driver team mailing list archive

[Question #161532]: Allow for hooks before/during/after Sikuli actions

 

New question #161532 on Sikuli:
https://answers.launchpad.net/sikuli/+question/161532

Hi,

We'd like to write an extension that, among other things, modifies common Sikuli actions (e.g., click, wait, any Image Search).  As a few examples,
  - on type(image, 'txt'), we'd like to insert a delay between the click(image) and the type('txt') actions.
  - on any image search during a script, take a screenshot of the desktop and save it somewhere.
  - insert different logging statements (e.g., "Click foo.png" instead of "Click (100, 200)").

One possibility is to create an extension with the same interface as Sikuli and make people replace all their Sikuli calls with ours, e.g.,:
  Sikuli.click(image)
becomes
  our_extension.click(image).

What I'd like even more though, would be if people using our extension didn't have to modify their test code (much) in order to benefit from our modifications to these functions.  Ideally all they'd have to do is something like "our_extension.initialize()", and this would either replace "Sikuli.click()" with our version, or maybe our extension registers handlers like "beforeSikuliClick(<our_extension.some_method>);" so that Sikuli knows to call some_method before it performs a click.

We found out that that's possible (replacing sikuli.Sikuli.click with our extension.click) to do through python, since you can just manually edit the modules you import, but haven't figured it out in Java.  But before we try too hard on that route...

The question(s):
  1) Is there any support for doing these kinds of things already?
  2) Any support planned?
  3) If no to 1 and 2, but you think this might be useful, we might try to make these modifications ourselves and push them upstream.  In which case, maybe we can chat offline.

Thanks!

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.