[1.1.4] using Javascript - how to?

Asked by BrazilMac on 2018-09-11

DOCS:
https://sikulix-2014.readthedocs.io/en/latest/scenarios.html#using-javascript

----------------------------------------------------------
Hi Everyone,

I am new to SIkuli, I managed to code a simple script using the IDE...I am a proficiend JS/Node dev and Im wondering if there are any examples of a script written in pure javascript, is it possible? And if so, whats the approach for call all the functions as in the IDE, do I need to make any "require" and such? I needed some more advanced stuff but a bit stuck here

Thanks again

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-09-11
Last reply:
2018-09-11
RaiMan (raimund-hocke) said : #1

I will try to give you an idea asap.

BrazilMac (isoripper) said : #2

Hi RaiMan, thanks so much!!! This would be such great help

RaiMan (raimund-hocke) said : #3

Uuuups, too fast ;-)

I just realized: Java 11 does not have the Nashorn (JavaScript) engine anymore.
Since I will completely switch to Java 11, I have a problem now.

An option for you is to stay with Java 10, until another solution is available (GraalVM, Rhino, ...).

But coming from the Node environment: Do not expect too much, only the basic language elements are supported. The rest is done at the Java level (and of course nothing related to DOM and all the web stuff).

May be it is better to decide for either Python or Ruby as scripting language (the syntax structure of Ruby might be more familiar for JavaScript users).

Nevertheless, I will be back with comment #1 asap

BrazilMac (isoripper) said : #4

Thanks Raiman,

As I plan to run this on Linux, I am running 1.1.3 instead. On my Ubuntu 16 box I have Java

OpenJDK 1.8.0_181
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)

RaiMan (raimund-hocke) said : #5

LOL --- just realized, that the basics are already in the docs:
https://sikulix-2014.readthedocs.io/en/latest/scenarios.html#using-javascript

If you want to dig into the gory details - come back.
Ideas and contributions are highly welcome ;-)

BrazilMac (isoripper) said : #6

I will check it out and come back :D

Can you help with this problem?

Provide an answer of your own, or ask BrazilMac for more information if necessary.

To post a message you must log in.