This may be a simple question but I can't for the life of me figure out what I'm doing wrong. I'm experimenting with casperjs to build a scraper. I've followed the tutorial for downloading it with brew found here:
http://docs.casperjs.org/en/latest/installation.html
I then continued onto the quick start found here:
http://docs.casperjs.org/en/latest/quickstart.html
I saved the sample.js file to my desktop and attempted to run it from terminal using:
$ casperjs sample.js
However it always returns unable to open file: sample.js. If I just run $ casperjs in the terminal all of the information about what version it is etc comes up so it seems like casperjs is installed correctly.
I also made sure the required prerequisites were installed. I realize this isn't a whole lot of information to go on but does anyone have any ideas?
This is the error code I get in the terminal:
Unable to open file: sample.js
Second edit:
Maybe where I'm having trouble is with these prerequisites?
Python 2.6 or greater for casperjs in the bin/ directory
I have python installed but I'm not sure about the "for casper in the bin/ directory" part. The documentation doesn't say anything about how to do that.
Phantom 1.9.7-15 and Casper 1.0.3
In my case, while typed 'casper testScript.js' this was going to node_module/.../.../casper and was trying to find the file testScript.js which was in different place. Changing the name of file to full path fixed the issue. Also i think that message displayed is a little bit incorrect, "Unable to open file:" isn't "file not found" ...
Quick fix: change the 'testScript.js' part for full path. For me, helped. From:
Unable to open file: testScript.js
To:
CasperJS, a navigation scripting and testing utility for PhantomJS and SlimerJS
PhantomJS | PhantomJS
Later I've changed the PATH variables and aliases. Everything works fine.
Hope it will help someone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With