How to have Phantomjs execute a js file on Windows

霸气de小男生 提交于 2019-12-11 01:40:31

问题


I just executed phantomjs.exe and a command line window popup. How could I execute the .js files under ./examples/? If just enter the file name "version.js", I got the error message - "cannot find the variable: version".

Thank you!


回答1:


Open the command window - this can be done by holding SHIFT + Right mouse click and there is a choice of Open command window here...

From the command line you can then invoke the phantomjs.exe

  $ path/to/phantomjs.exe path/to/version.js



回答2:


You can also create windows environment path variable

add path/to/phantomjs.exe as environment variable with name phantomjs

then From the command line you can then invoke the phantomjs

$ phantomjs path/to/version.js



回答3:


A better answer (I think) is : Add the path to the folder containing phantomjs.exe, to the PATH environment variable :) on Windows.



来源:https://stackoverflow.com/questions/12551218/how-to-have-phantomjs-execute-a-js-file-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!