MangoTools / node-slimerjs

Other
16 stars 4 forks source link

page object passed into callback by createPage does not have "settings" property #4

Open f0ster opened 9 years ago

f0ster commented 9 years ago

I am trying to access the "settings" property on the page object, but it is undefined. http://docs.slimerjs.org/current/api/webpage.html#webpage-settings

var slimer = require('node-slimerJs');

slimer.create(function(err,sl) {
  return sl.createPage(function(err,page) {
    console.log(err);
    page.settings.userAgent = 'TEST USER AGENT STRING';
    console.log("Using UA " + page.settings.userAgent);
  });
});

With erroring result:

Macintosh:test user$ node slimer_node_test.js 
Slimer spawned with web server on port: 56995
Page created with id: 1
null
Slimer spawn err: TypeError: Cannot set property 'userAgent' of undefined
puzrin commented 9 years ago

Those properties are not local. You should use set/get methods for access.