Search code examples
node.jsformsweb-scrapingnightmare

Web-scrape by nightmare how to deal the form in action and submit


I Web-scrape by nightmare in

http://football-system.jp/fss/pub_taikaigamelist.php?lid=eBVesRz5C54=

I want to get the page after click the score button like 0-1.But the page use form.action and .submit to send some information.I dont know how to get the after page.please help me.

I write some code to get the text but dont know how to get the next(after click)page.

var Nightmare = require('nightmare');
var nightmare = Nightmare({ show: true });
var fs  = require('fs');
vo = require('vo');

nightmare
        .goto('http://football-system.jp/fss/pub_taikaigamelist.php?lid=eBVesRz5C54=')
        .wait(1000)
        .click('a[href="javascript:void(0);"]')
        .wait(1000)
        .evaluate(function () {
         var counts =     document.querySelector('a[href="javascript:void(0);"]').innerHTML;
         return counts;
        })
        //.end()
        .then(function (values) {
           console.log(values);
      })
      .catch(function (error) {
        console.error('Search failed:', error);
      });

Solution

  • OK I got some message from others . I think this problem cant be solve by nightmare . The casperjs maybe can do it by this link http://docs.casperjs.org/en/latest/modules/casper.html#waitforpopup