brenden / node-webshot

Easy website screenshots in Node.js
2.12k stars 285 forks source link

page.settings.javascriptEnabled = false not work #200

Open showwell0120 opened 7 years ago

showwell0120 commented 7 years ago

I want to disable the behaviors such as displaying ads mask in webpage (e.g. https://www.thestreet.com/story/14103442/1/credit-suisse-plans-4-billion-capital-increase-will-keep-domestic-business-in-house.html). When I test page.settings.javascriptEnabled = false using command line, it works. Just like this- test.js:

var page = require('webpage').create();
page.settings.javascriptEnabled = true;
page.open('https://www.thestreet.com/story/14103442/1/credit-suisse-plans-4-billion-capital-increase-will-keep-domestic-business-in-house.html', function() {
  page.render('thestreet.png');
  phantom.exit();
});

command line: phantomjs test.js

But when I add this setting in webshot.phantom.js, it would crash. Can somebody have any idea with it?