How to click on the link and remain authorized

16 views
Skip to first unread message

Роман Сергеев

unread,
Jun 29, 2017, 8:42:25 AM6/29/17
to phantomjs
That's how I'm authorized on the site:
var webpage = require('webpage');
var page = webpage.create();

page.settings = {
    loadImages: false,
    javascriptEnabled: true,
    encoding: "utf8",
    userAgent: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36',
};

phantom.cookiesEnabled = true;

page.open("http://www.example.com/profile/Login.aspx", function(status) {
    if (status === "success") {
        page.evaluate(function() {
            document.getElementById("ctl00_ContentPlaceHolder1_tbUsername").value = "admin";
            document.getElementById("ctl00_ContentPlaceHolder1_tbPassword").value = "1234";
            document.getElementById("ctl00_ContentPlaceHolder1_btnLogin").click();
        });
        window.setTimeout(function() {
            console.log(page.url);
            phantom.exit();
        }, 2000);
    }
});

How can I now follow the link and remain authorized?

Reply all
Reply to author
Forward
0 new messages