Basic Operations API

The basic operation API for automating Windows application objects is obtained by introducing the "WinAuto" class object exported from the "leanpro.win" package.

JavaScript
const { WinAuto } = require('leanpro.win');

WinAuto

The WinAuto object is used to directly generate Test Object through Descriptive Mode,without loading the object model.

This class has the following methods:

JavaScript
class WinAuto {
    static fromPoint(x: number, y: number): Promise<IWinControl>;
    static get(obj: IWinControl): IWinTypeControl;
    static highlight(rect: Rect, duration: number);
    static loadModel(modelPath: string): IModel;
}

  • loadModel

loadModel load object model from a model file, and return the model object. The following is an example:

JavaScript
const { WinAuto } = require("leanpro.win");
var model = WinAuto.loadModel(__dirname + "/simle_styles.tmodel");

async function run() {
    await model.getButton("Default").click();
}

run();