How to call AppleScript(*.scpt) file in Playwright Framework?

Viewed 29

I have to call AppleScript(*.scpt) for uploading a file to our application.Please see the below code and let me know how to resolve this !

import applescript from 'applescript';

public async uploadFile(): Promise<void> {
let filePath = "./files/largeFile.m4v";
let scriptPath="./files/uploadFileUsingScript.scpt";

        await applescript.execFile(scriptPath,[filePath], async function(err, stdout) {
            if (err) {
             logger.info(err);
            }
            else{
                logger.info(stdout);
            }
          });
}

Error: ./files/largeFile.m4v:0:1: script error: A unknown token can’t go here. (-2740)

    at ChildProcess.<anonymous> (/node_modules/applescript/lib/applescript.js:49:13)
    at ChildProcess.emit (events.js:315:20)
    at ChildProcess.EventEmitter.emit (domain.js:467:12)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
  appleScript: './files/uploadFileUsingScript.scpt',
  exitCode: 1
}
0 Answers
Related