无法使用 phantomjs 加载 Instagram 登录页面

问题描述

我刚刚了解了 phantomjs,但我不能像 phantomjs.org 中的示例一样转到 instagram 页面 有人可以帮我吗

我希望我可以在这里学习或获得一些经验

Windows 10 版本 幻影 2.1.1 souladi 使用一些 webdriver??,因为我在网上读到很多讨论 abot selenium 或其他 webdriver

有什么建议吗?

var page = webPage.create();

page.viewportSize = {width: 1280,height: 1024};

var testindex = 0,loadInProgress = false;

// page.settings.userAgent =  "Mozilla/5.0 (Linux; Android 10; SM-G975U) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/79.0.3945.93 Mobile Safari/537.36";
// page.settings.userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebkit/537.36 (KHTML,like Gecko) Chrome/84.04147.105 Safari/537.36";
browser = webdriver.PhantomJS()

page.onLoadStarted = function() {
  loadInProgress = true;
  console.log("load started");
};

page.onLoadFinished = function() {
  loadInProgress = false;
  console.log("load finished");
};

function load()
{
    page.open("https://instagram.com/accounts/login/",function(status){
      if(status==="succes"){
        page.render('1coba.jpeg',{format:'jpeg',quality:'100'});
        page.evaluate(function(){
          document.getElementsByClassName("._2hvTZ").value="username%password";
          document.getElementsByClassName(".Igw0E").submit();

        });
        
      }else{
        page.render('1coba.jpeg',quality:'100'});
        page.evaluate(function(){
          document.getElementsByClassName("._2hvTZ").value="username&password";
          document.getElementsByClassName(".Igw0E").submit();

        });
      }
      
    })  
}
function upload()
{
    page.uploadFile('.q02Nz','//path');    
    page.render("2coba.jpeg")
}

function finish()
{
  page.render('3coba.jpeg',quality:'100'});
}

var steps = [
    load,upload,finish
]

interval = setInterval(function() {
  if (!loadInProgress && typeof steps[testindex] == "function") {
    console.log("step " + (testindex + 1));
    steps[testindex]();
    testindex++;
  }
  if (typeof steps[testindex] != "function") {
    console.log("test complete!");
    phantom.exit();
  }
},2000);    

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)