Blank Web Page with PhantomJS and CasperJS

Today, I was attempting to debug an issue where some of our functional tests were not running with the new React powered parts of

As part of the debugging process, I decided to see if the tests would pass when run from my local machine instead of our test server. But, any time I ran a test, the test would fail.


An Example Test

Here is part of the test that we use to test the log-in/log-out functionality on

casper.test.begin( ‘Can log in to WordPress’, function suite( test ) {
casper.start( ‘’, function() {
test.assertExists( ‘.click-wpcom-login’, ‘Login link exists on front page when logged out’ );
} ); ( function() {
} );
} );

But, when I run this test, this is the output that I get:

# Can log in to WordPress
FAIL Login link exists on front page when logged out
# type: assertExists
# file: logging-in-out.js:3
# code: test.assertExists( ‘.click-wpcom-login’, ‘Login link exists on front page when logged out’ );
# subject: false
# selector: ".click-wpcom-login"

To debug this test, I dumped the HTML to my terminal and got this: <html><head></head><body></body></html>

The Fix?

After searching a bit, I found this answer.

It seems that there was a mismatch between the version of TLS that uses and the version that PhantomJS uses.

I was able to get my test to work by changing the command to: casperjs test --ssl-protocol=any logging-in-out.js

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.