Script Editor

The Script Editor is an development environment for authoring Node.js automation scripts, and it also supports the development of VBScript and JavaScript (WScript) scripts. Note that if you are using LeanRunner Lite, you can only run Node.js. It provides a variety of features, including project creation, run, auto-completion, script verification and more.

Auto-completion

When import "leanrunner" library with "require" statement, you can access the object model of LeanRunner and get intelli-sense for the script code. As shown below:

TestModel is the object model, and can be loaded with loadModel call. For example:


const {TestModel, Util} = require('leanrunner');                //line 1
let model = TestModel.loadModel(__dirname + '/test.tmodel');    //line 2
(async function () {                                            //line 3
    await model.getButton("Five").click(0, 0, 1);               //line 4
})();                                                           //line 5

The code in the above figure also shows another require call, which is:

const { TestModel, Util } = require('leanrunner');

This can be used directly to get TestModel or other related objects.

The second line gets the model object model through loadModel, and the rest of the lines use the model to access the control and perform operation on it.

Line 3 ~ 5 calls the method of the button in asynchronous manner. All operations on objects in Node.js are asynchronous, which means a Promise object is returned. If you want to wait for it to complete before making the next await call, the await function needs to be placed in the async function. To learn async/await syntax, see the JavaScript tutorial for more information.

results matching ""

    No results matching ""