0

I have a js script using casperjs and phantomjs. It loads a website logs in and performs some actions. It works quite well on the two Macbooks I have tasted it with. Then I tried to execute it from a digitalocean ubuntu server, but the login failed.

Now I tried it on my rapsberry pi and it fails, too. I made a screenshot of the login page which is empty. (It isn't empty when I rund it on Mac OS X)

Are there any things that I have to do, to get it running on Debian/Raspbian/Ubuntu that I'm not aware of?

Update:

When I catch the "resource.error" event I get a SSL handshake failederror.

Bernd Strehl
  • 2,852
  • 4
  • 24
  • 43
  • I have not used those libraries before but I found this link to someone with a similar problem that might help you http://stackoverflow.com/questions/6448459/phantomjs-command-not-found. – Larry Lane Mar 12 '16 at 14:20
  • I can run casperjs and (phantomjs) from bash. That's not the problem. The problem is that the script doesn't seem to load pages correctly – Bernd Strehl Mar 12 '16 at 14:33
  • Are there any errors logged on the pages? – Larry Lane Mar 12 '16 at 14:46
  • not sure how to get them, but I guess not – Bernd Strehl Mar 12 '16 at 18:01
  • Is the web page being served in a browser? if so right click on web page and click inspect element. From there you can click on the net panel to see http requests and check if your resources are loading. The console tab will display any errors thrown by your JavaScript code. If your environment is giving you access to a console like I have described let me know and I can try and help with any messages you receive. – Larry Lane Mar 12 '16 at 19:36
  • You have probably already checked this but I thought it might be worth a shot. I was looking on the phantomJS website and I noticed there are different executables for each platform. Have you downloaded the correct platform for the linux(32 bit or 64 bit). http://phantomjs.org/download.html – Larry Lane Mar 12 '16 at 19:43
  • Phantomjs is a headless browser there is no "inspect element". Since I'm running this script on a raspberry pi I got a ARM compiled binary of phantomjs. – Bernd Strehl Mar 13 '16 at 14:31
  • I have not used a raspberry pi so I am afraid I will not be of much help to you. – Larry Lane Mar 13 '16 at 14:59
  • Which PhantomJS version do you use (remember that CasperJS might use its own internal PhantomJS version and not the one on the PATH)? Please register to the `resource.error`, `page.error`, `remote.message` and `casper.page.onResourceTimeout` events ([Example](https://gist.github.com/artjomb/4cf43d16ce50d8674fdf#file-2_caspererrors-js)). Maybe there are errors. – Artjom B. Mar 13 '16 at 15:21
  • @ArtjomB. Sorry I'm responding that late, didn't had the time to test it. I found an error. See the updated question. – Bernd Strehl Mar 27 '16 at 19:31
  • Which PhantomJS version do you use? The error is most likely solved by this: [CasperJS/PhantomJS doesn't load https page](http://stackoverflow.com/a/26419531/1816580) – Artjom B. Mar 27 '16 at 19:38
  • @ArtjomB. 1.1.0-beta5 – Bernd Strehl Mar 27 '16 at 19:45
  • No, not the CasperJS version. I meant the PhantomJS version. – Artjom B. Mar 27 '16 at 19:46
  • oh sure, sorry: 1.9.8 @ArtjomB. – Bernd Strehl Mar 27 '16 at 19:48
  • Are you sure? CasperJS may use its own internal version of PhantomJS if you installed it through npm. – Artjom B. Mar 27 '16 at 19:49
  • @ArtjomB. how can I check that? I guess there is only one version of phantomjs on my Pi because I had to get a ARM compiled phantomjs bin – Bernd Strehl Mar 27 '16 at 19:50
  • Hm, I guess there is something else going on. Have you tried running it with the `--ignore-ssl-errors=true` commandline flag? Have you tried PhantomJS 2.1.1 (I know it takes a long time to compile)? – Artjom B. Mar 27 '16 at 19:57
  • actually with `--ssl-protocol=tlsv1 --ignore-ssl-errors=true` it works. Thanks for you help, mate! – Bernd Strehl Mar 27 '16 at 20:03

0 Answers0