D
D
dmitred2016-12-27 20:10:50
JavaScript
dmitred, 2016-12-27 20:10:50

How to navigate to page after Phantomjs login?

Good evening, please tell me how can I go to another page after authorization? The code below goes through authorization and saves the picture of the authorized user, everything is fine, but I need to go to one more internal page, in the audio https://vk.com/audios7576740

var webpage=require('webpage');
var fs=require('fs');
var system=require('system');

var page=webpage.create();
var url="https://vk.com/login";



page.settings = {
  loadImages: false,
  javascriptEnabled: true,
  userAgent: 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1',
};



var page = require('webpage').create();
phantom.cookiesEnabled = true;

page.open("https://vk.com", function(status) {

  if (status === "success") {
    page.evaluate(function() {
        document.getElementById("index_email").value = "логин";
        document.getElementById("index_pass").value = "пароль";
        document.getElementById("index_login_button").click();
    });
 


window.setTimeout(function() {
    
           page.render("vk.png");
    phantom.exit();   
   
    }, 5000);
    
    
  }
  
  
  
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Никита Каменев, 2016-12-27
@dmitred

Сделать очередной page.open(). А вообще для работы с вк я думаю лучше использовать их API :-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question