Reputation: 2005
I use the netsniff.js like this:
phantomjs --ignore-ssl-errors=true --ssl-protocol=any netsniff.js http://thermex.ru/ > t.out
When netsniff is done, I open file t.out in my text editor and I see the JS bugs like this:
TypeError: 'undefined' is not a function (evaluating '$('.bxslider').bxSlider({ mode: 'fade', preloadImages: 'all', slideWidth: 697 })') http://thermex.ru/:565 http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js:2 http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js:2 http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js:2 http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js:2
after this errors I see valid HAR data.
But I don't can parse this file, because him contains no valid JSON data (JS errors + valid JSON HAR data = no valid JSON data).
How can I receive the valid file from netsniff.js for this domain?
Upvotes: 2
Views: 237
Reputation: 61892
You can register to the page.onError
, page.onConsoleMessage
and phantom.onError
events to prevent the default action (before page.open
in netsniff.js):
page.onError = function(){};
page.onConsoleMessage= function(){};
phantom.onError = function(){};
Upvotes: 2