So, I have a strange problem.
I have a Jasmine test runner running locally on my machine, available on localhost: 8080 / test / runner.html
When I open it in a web browser, it works fine.
I wanted to automate this, so I use phantomjs (installed from brew - I am on a mac) and I use the sample run-jasmine.js file from the code.
But, when I run it against the url, I get the following:
phantomjs war/test/spec/run_jasmine.js http://localhost:8080/test/runner.html 'waitFor()' timeout
So, I wrote a very simple script to see if there is something that I am missing:
var page = require('webpage').create(); page.open(phantom.args[0], function(status) { if (status !== "success") { console.log("Unable to access network"); phantom.exit(); } else { if (document.body.querySelector('#hello')) { console.log('hi'); } } });
And created a new HTML file:
<!DOCTYPE html> <html> <head> <title>hi</title> </head> <body> <div id="hi"></div> </body> </html>
And the thing is still just hanging forever.
Am I missing something? I know the page is loading, but it does not look like phantomjs ever parses it.
tkone source share