You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
page.getPage(name) can be used to retrieve pages that are children of another page. However, the pages that are retrieved by this function are not node-phantom-simple page instances, but a json-ifined phantom-page.
'use strict';letdriver=require('node-phantom-simple');letonCreated=function(err,page){page.onPageCreated=function(childPage){childPage.evaluate(function(){window.name='myName';},function(){page.getPage('myName',function(err,newChildPage){console.log('Is null: ',newChildPage===null);console.log('Has render:',typeofnewChildPage.render!=='undefined');console.log(Object.getOwnPropertyNames(newChildPage));process.exit();});});};page.evaluate(function(){window.open("");// open a blank page});};letonPhantomCreated=function(err,phantom){phantom.createPage(onCreated);};driver.create(onPhantomCreated);
page.getPage(name)
can be used to retrieve pages that are children of another page. However, the pages that are retrieved by this function are not node-phantom-simple page instances, but a json-ifined phantom-page.Output:
As you can see, the object has no actual functions, but only properties that are usually found on the phantom instance of the page.
The same fix you applied to
onPageCreated
will apply to this.The text was updated successfully, but these errors were encountered: