Guidance for using the Java API (not reinventing the wheel) #397
-
|
I'm a long-time SikuliX IDE user, but I've never felt like the python was very tidy, so just recently I downloaded the whole artifactId oculix into Eclipse and made an Eclipse project with a dependency on artifactId oculixapi. I asked AI to translate my Sample.py and I moved over the image files from Sample.sikulix folder and it works. Now what I'd like to do, before I move over more of my original code is make a tidy Java framework that "does things right", such as keep artifacts segregated and organized and have ways to do things like drop in another version of an icon and have the new one, or any older one, found. I had a bunch of helper methods in python, but there was so much more that I know could be done to make scripts more maintainable and less brittle. What I figured was someone must have written a wrapper or companion, but I didn't find one. Short of that, I searched for youtube videos, but the ones I found were not "How I configure my Java objects to use the API in a way that's easy to build and maintain." I just started on this today, and I already have some ideas about keeping each web page as a separate class, with any images to match associated with that class. And some utility classes to run to make sure all of the resources are found before starting. I even created a Swing thread to show the images being waited on or clicked on and a countdown timer. Anyone that's done web automation with SikuliX on web sites they don't control know that these web sites are always tweaking things, so it's a never ending effort to keep scripts running. That's why I want to see what's going on real time and be able to easily make changes to the code as changes happen to the web site. So, any guidance would be appreciated. I suppose RTFM is in order, but way too many times I can read about something and not know how it can be leveraged to do something really helpful. That's the bit about not reinventing the wheel. If someone has some examples that leverage the API in cool ways to make it easier to make the API sing and dance, that's what I'm after. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
I am @RaiMan (from SikuliX) and wish you a warm welcome in the Oculix sphere. Some words on the history and the Python language decision
Later the Java API got into focus more and more, since other people wanted to integrate the features into their own dev ideas. So my answer to your decision, to move from the Python scripting level to the Java programming level is simply: do not do it
… and now Oculix has a direct Python implementation: pypi oculix So whatever you do, some basic recommendations:
One more thing: IMHO the organization and handling of your images is vital, to minimise the overall effort. And this is a challenge already if you dev outside the SX/OX IDE, but gets even more challenging at the programming level (make, name and integrate screenshots). Hope it helps. |
Beta Was this translation helpful? Give feedback.
-
|
@sengsational — and @RaiMan's reply above is the right anchor to read first. Worth thanking him: the Python/Jython lineage he describes is the soil this whole tooling grew on, and it's still good soil today. To genuinely take his caveats on board:
That said, your case has legitimate reasons for Java: existing Java team, Eclipse already set up, the wish for compile-time guarantees and IDE refactoring power Python doesn't offer in the same way. The trade-off depends on the team, and you've made the call honestly. Quick reactions on your three ideas, language-independent:
Concrete proposal. I've been incubating a Java framework on top of OculiX along the exact same axis as your work — a What I'd like to propose: I open a public repo inside Once it's in shape, the Java framework becomes the natural Java-side companion to OculiX — the way Operix is the Python-side companion. Both lanes valid, both supported. No pressure, no obligation — open invitation, your call on pace and scope. If after trying Operix you decide @RaiMan's Python route is the better fit, that's also a perfectly good answer. 🦎 |
Beta Was this translation helpful? Give feedback.
-
|
Interesting - you say: I've been incubating a One more thing for this thread: |
Beta Was this translation helpful? Give feedback.
I am @RaiMan (from SikuliX) and wish you a warm welcome in the Oculix sphere.
Some words on the history and the Python language decision
Some 15 years ago, when I took over from the MIT Sikuli, this was already decided and some good choices at that time: