Can I get the original page source (vs current DOM) with phantomjs/casperjs?

前端 未结 3 646
栀梦
栀梦 2021-01-05 04:01

I am trying to get the original source for a particular web page.

The page executes some scripts that modify the DOM as soon as it loads. I would like to get the sou

3条回答
  •  有刺的猬
    2021-01-05 04:38

    Regarding the docs you can use #debugPage() to get the content of the current page.

    casper.userAgent('Mozilla/5.0 (Macintosh; Intel Mac OS X)');
    
    casper.start('http://www.xxxxxxx.xxx/login');
    
    casper.waitForSelector('input#login', ... );
    
    casper.then(function() {
      this.debugHTML();
    });
    
    casper.run();
    

    regards david

提交回复
热议问题