ariya / phantomjs

Scriptable Headless Browser
http://phantomjs.org
BSD 3-Clause "New" or "Revised" License
29.46k stars 5.76k forks source link

cant load instagram page #15453

Closed nemeshine closed 3 years ago

nemeshine commented 3 years ago

can somebody explained why i cant load instagram page?? sorry if me annoying cause i just wanna learn phantomjs

             **Versions**

windows 10 phantomjs : 2.1.1

this is my sample

`var webPage = require('webpage'); 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";

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',{format:'jpeg', quality:'100'});
    page.evaluate(function(){
      document.getElementsByClassName("._2hvTZ").value="username&password";
      document.getElementsByClassName(".Igw0E").submit();

    });
  }

})  

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

function finish() { page.render('3coba.jpeg',{format:'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);
`

i hope i can learn or get some experience form here 3coba

jgonggrijp commented 3 years ago

@maajja Welcome to GitHub!

You are welcome to learn PhantomJS, but I should mention that this is not the best place for this type of question. "How come my code doesn't work" and "how to" type of questions are better asked at a site like https://stackoverflow.com; there is a much larger audience over there of people specifically looking to answer questions like these.

Also a tip: your code will look better if you put it between triple-backtick code fences, like this:

```
// your code
```

This also works on Stack Overflow. Please put a link here when you've posted your question over there!

stale[bot] commented 3 years ago

Due to our very limited maintenance capacity, we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed (see #15395 for more details). In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!