3

i googled this question, but all are saying about html+css+js and with mixed answers. But i have only javascript file which i need to convert into exe file with arguements passing into it and i need to use this into my automation framework on a case as a step to execute a case, which is written in c#,selenium (i am new to microsoft stacks)

In javascript file i use to pass like

node Wallet.js "<address>", "<amount>"

like wise i would like pass something like

wallet.exe "<address>", "<amount>"

or else if we can use the javascript (node program) as is it inside c# code, how can we call it. But it would be an additional dependency that we need to have node installed on the machines. Any help would be much appreciated.

mmar
  • 1,840
  • 6
  • 28
  • 41
  • 2
    You can use Electron for HTML apps: https://electronjs.org (Check out the guide as well on creating your first Electron app: https://electronjs.org/docs/tutorial/first-app) – Edric Feb 20 '19 at 13:52
  • OP wants to package his .js to an executable, how exactly is Electron gonna help him do that? – Azami Feb 20 '19 at 14:04
  • Maybe try [NectarJS](https://github.com/NectarJS/nectarjs). – TGrif Feb 20 '19 at 14:40
  • I'm not sure how making this an exe is going to help you execute this code from c#? – Liam Feb 20 '19 at 14:58

2 Answers2

1

If you are using NodeJS for executing the JS file. You can install pkg module globally for creating Node binaries for different platforms. (npm install -g pkg)

Checkout: https://www.npmjs.com/package/pkg

Command: pkg myfile.js

Will create 3 binaries for Windows, linux and MacOS. You can pass the platform parameters accordingly.

Imtiyaz Shaikh
  • 425
  • 3
  • 7
0

It may not be accurate but one thing you can do is,

  • create a script.sh file and add make it executable & add
  • node Wallet.js "address", "amount" in it

Now, you can run this directly or from any file you need like you want i.e

./script.sh "address", "amount"

Muhammad Aadil Banaras
  • 1,134
  • 1
  • 11
  • 21