T
T
tp1232014-03-24 23:46:46
PhantomJS
tp123, 2014-03-24 23:46:46

PhantomJs - how to log in to the site and pass through the site?

I wrote a small js script, I want it to enter the site by login and password and render the page I need. You can get in, but you can't go further

var page = require('webpage').create();
phantom.cookiesEnabled = true;
page.open("http://www.facebook.com/login.php", function(status) {

  if (status === "success") {
    page.evaluate(function() {
        document.getElementById("email").value = "[email protected]";
        document.getElementById("pass").value = "12345";
        document.getElementById("u_0_1").click();
    });


window.setTimeout(function() {
       page.render("fb.png");
    }, 5000);

page.open('https://www.facebook.com/friends/requests/?fcref=ff', function() {
      window.setTimeout(function() {
       page.render("fb2.png");
       phantom.exit();
    }, 5000);
    });
  }
});

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question