I'm pretty far down the path of incorporating SlimerJS into my web scrapers and I've come across an issue. One site I am working on just had their SSL certificate go invalid. Upon looking at Slimer's SSL documentation, it appears that they do not support PhantomJS's ignore-ssl-errors
option. Is there a way around this? The SSL certificate error page that appears in the browser does not have any sort of continue
button that I can make Slimer click. As an FYI, I am using CasperJS as a wrapper for SlimerJS.
My blog entry (pasted in below) explains how (and it shows the Casper instructions too):
SlimerJS (as of 0.8.3) lacks the commandline options of PhantomJS to say "relax about bad certificates". Unfortunately the self-signed SSL certificate, that developers typically use during development, counts as a bad certificate.
Here are the steps needed to handle this:
slimerjs --createprofile AllowSSL
Make a note of the directory it has created.
(You can call your new profile anything, "AllowSSL" is just for example.)
Go to normal desktop Firefox, browse to the URL in question, see the complaint, add it as a security exception. Chances are, if you have been testing your website already, that you've already done this and you can skip this step.
Go to your Firefox profile, and look for the file called "cert_override.txt". Copy that to the directory you created in step 1.
Have a look at the copy you just made of "cert_override.txt". If it only has the entry you added in step 2, you are done. Otherwise, remove the entries you don't want. (The file format is easy: one certificate per line.)
Now when you need to run slimerjs you must run it with the "-P AllowSSL" commandline parameter.
E.g. slimerjs -P AllowSSL httpstest.js
If you are using SlimerJS with CasperJS (requires CasperJS 1.1 or later), do the same, e.g.
casperjs test --engine=slimerjs -P AllowSSL tests_involving_https.js
Use export SLIMERJSLAUNCHER=/usr/bin/firefox
to have SlimerJS use your local copy of Firefox, rather than its internal Gecko engine. This should definitely work, because in step 2 above you added the security exception to that version of Firefox. (The rest of the instructions above are just for getting it to work with the internal Gecko engine that comes with SlimerJS.)
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