It is not always enough to evaluate the page immediately after loading it. Sometimes, due to the way JavaScript is written on the page, you will have to wait and allow the execution of the JavaScript page. To this end, I suggest you try and add expectation before completing the assessment. eg.
function ( status ) { if ( status === 'fail' ) { phantom.exit( 1 ); return;
If you find that you need to wait, then you can wait for something. To this end, find waitFor or a similar function on the Internet that allows your script to continuously poll until a specific DOM element appears.
source share