Phantomjs Async function call

47 views
Skip to first unread message

Pavan Tiwari

unread,
Aug 10, 2018, 3:36:30 PM8/10/18
to phantomjs
Hi All,

I am trying to run some dom manipulation operation through async function in phantomjs.
Because dom manipulation causes phantomjs to do relayouting of entire DOM. To run function async I have used setTimeout function but it seems like phantomjs simply ignores it.

then I have tried evaluateAsync but no success. Code sniped is given below.
I wanted to build Reactjs like virtual dom to avoid relayouting of full page. Can someone suggest me something to improve the page processing with phantomjs

page.onConsoleMessage = function(msg) {
      console.log('The web page said: ' + msg);
    };


 page.open('/Users/somenamr/Desktop/test/test.html', function(status) {
        if (status == 'success') {

            page.evaluateAsync(function() {
       console.log('This is not getting logged. Hi! I\'m evaluateAsync call!');
    }, 1000);

            var html = page.evaluate(function(s) {

    window.console.log = function(msg) { alert(msg) }; 
             function doProcessingOnWebPage(node)
             { 
                 console.log("this i am getting");
             }});}});
Reply all
Reply to author
Forward
0 new messages