PhantomJS and SlimerJS fail to render some sites - phantomjs

I didn't get any output file (image) when trying to execute render_multi_url.js in phantomjs or slimerjs for some url like:
www.tamasoft.co.jp/en/general-info/unicode.html
www.bbc.co.uk
I am using the latest version of both phantomjs and slimerjs. render_multi_url.js is the original script shipped with phantomjs. Under slimerjs I get no image at all and under phantomjs I get partial image (over 9mb). Why do I get this behavior?
So what I need to change or improve to get this script working on any web page?

The root cause of the issue, that SSL3 (used by default in P-js) was changed to TLS1 (or better use 'any').
To fix that you should specify the SslProtocol option.
This is the way for c#:
var service = PhantomJSDriverService.CreateDefaultService(driverPath);
service.SslProtocol = "any"
In command line you can use
--ssl-protocol='any'

Related

casperjs.bat on windows fails with cannot find module cli.js error

I'm trying out casperJS to run some automated tests. On windows. I followed this installation guide but am stuck.
when I try to run a simple test from the command line like this:
casperjs.bat smoketest.js
I get the following error:
Error: Cannot find module 'C:/code/base/main/Shared/casperjs\modules\cli.js'
I checked, and the file cli.js does exist under the specified path.
I thought the problem could be the mixture of forward and backward slashes in the path, but I edited the bootstrap.js casper code to hard code the path and it made no difference - it still the cannot find module.
I'm have tried this using phantomJS version 1.9.0, and 1.8.2.
Anyone know what I am doing wrong?
Has anyone had success running casper on Windows?
This is due to a bug in PhantomJS 1.9.0 that does not allow for absolute path loading in Windows. Afaik, this should only be apparent if you are using a master build of CasperJS (v1.1).
This bug has been fixed, but is not yet in the Windows binary. You can compile it yourself if you'd like, but that can take quite a bit of time.
I was using the master build of casper. With the latest released version, 1.0.2, it works fine.

enchant_broker_init() performance issue

I have a web site which uses enchant enchant_broker_init().
I`m not sure why but enchant_broker_init() takes something like 19~ seconds to load the page.
Once I remove this function page loads right away.
anyone has an idea why this is? or how can I debug it?
Thanks
Steps to install php enchant plugin.
APACHE
http://apache.mivzakim.net//httpd/binaries/win32/#warnings
PHP
http://windows.php.net/download/
ENABLE PHP ON APACHE
http://php.net/manual/en/install.windows.apache2.php
Enchant will not work using WAMP. ( at least for it hasn't... ).
Afterwards add the following path
share\myspell\dicts
to your PHP directory.
should look like that.
C:\PHP\share\myspell\dicts
Put the dictionary files there.
.aff
.dic

How do I run casper from within the phantomjs shell?

Anyone know if and how it's possible to run casperjs from within the phantomjs shell (a.k.a InteractiveModeREPL )?
I've also tried passing the direct path to the casper.js module and that has not worked either.
Progress/Update:
Tried phantomjs.injectJs('C:/casperjs/module/casper.js'); but got Error: Cannot find module 'colorizer' I guess I'm getting close.
This gets me closer but still missing path:
phantomjs.injectJs('C:/casperjs/module/bin/bootstrap.js')
errors out with Cannot find package.json at C:/package.json
OK, looks like I can pass the --casper-path option when starting phantomjs (see - casper/bin/bootstrap.js: line 189).
OK that worked. (passing the option did not work but setting the path inside of phantom did).
So to get this stuff to run inside the phantomjs shell first you need to set a casperPath variable in the phantom global object.
phantom.casperPath = "C:/casper";
Then you need to inJect caspers's bootstrap.js file.
phantom.injectJs("C:/casper/bin/bootstrap.js");
Now you can instantiate a casper object and play with it in the shell.
var casper = require("casper").create();
enjoy.

Can't get PhantomJS to work with a simple example

I've downloaded the executable and created a simlink to /usr/local/bin.
I'm under Mac OSX 10.7
When I then try to run a script that requires some module i.e.
var page = require('webpage').create();
I got an error
undefined:0 ReferenceError: Can't find variable: require
as if 'require' is not seen as a reserved word but interpreted as a variable symbol.
(As an aside, whenever I lunch phantomjs a Sencha Touch icon appears in my Dock)
Your copy of PhantomJS is from an older version. Always get the latest one from http://phantomjs.org.
I had this issue too, and the problem was my version of mocha -- going back to 1.9.0 fixed it.
SenchaTouch 2.0 installs PhantomJS 1.1 somewhere depending on the OS. Under *NIX check where with 'which phantomjs'.
Just modify your bash or whatever configuration file accordingly to remove the Phantomjs included with SenshaTouch from your PATH.

Selenium XHR ERROR: Response_Code = -1

I am using the newest version of Selenium RC and firefox 3.5 When I run my test from eclipse I get this error XHR ERROR: Response_Code = -1 Error_Message = Request Error.
Firefox and Selenium RC open up fine, it seems to try to connect to the remote site I want, but then firefox crashes, any ideas?
I'm pretty sure this is an issue fixed in trunk (and will come out in the pending 1.0.4 release). If you download 2.0a5, this includes a 1.0.x compatible Selenium server. You should be able to drop the -standalone JAR in place and have it work. If not, building from trunk is your next best bet.
Alternatively, you could try to modify the open command call. In dynamic languages, such as Ruby, this is fairly straightforward. open() takes a URL and a boolean as its values. You'll want to invert the logic for the second param (I think it's false by default, so you'll want true).