简体   繁体   中英

Do you need python to use casper.js ? if so why?

I never use python. The only language I know is JavaScript. I use node to do web work and I kept reading about how casper.js can scrape webpages. so I was thinking I could use it like usual. Now I am at the point of installing it and I get 'python' is not recognized as an internal or external command, operable program or batch file. I know this means to put python on my path. I don't want to install python.

I use JavaScript why should I install python? I'm just confused that since casper.js has a js at the end I would think that it would rely on js and not python. so can you confirm if I really need to install python. I really don't want to deal with another language right now. Is it a simple process?

Do you need python to use casper.js?

Yes.

If so, why?

CasperJS requires python because its devs chose to use python for its executable entrypoint and internal test runner .

There is discussion around removing the python dependency for the 2.0 release (shell scripts and node.js have both been proposed).


Also, just for clarity: CasperJS does not use node.js . The fact that node requires python is irrelevant. CasperJS is an interface to PhantomJS, which is a headless webkit driver that happens to be scriptable by javascript, but is not built on node.js.

From the Casper docs:

While CasperJS is installable via npm, it is not a node.js module and will not work with NodeJS out of the box. You cannot load casper by using require('casperjs') in node.

Yes, casper.js requires Python: http://docs.casperjs.org/en/latest/installation.html

PhantomJS 1.9.1 or greater. Please read the installation instructions for PhantomJS

Python 2.6 or greater for casperjs in the bin/ directory

However, all your coding will be in JavaScript. You don't have to (and, in fact, cannot) write a CasperJS script in Python.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM