atomjack / dubtrackapi

An API for creating bots on Dubtrack.fm
22 stars 5 forks source link

"Tried to login but was not successful. Sorry." [Mac OSX Yosemite] #15

Open technobly opened 9 years ago

technobly commented 9 years ago

Getting this error trying to login, a render before and after the creds entry. Seems like the login modal hasn't loaded. I've changed the timeout to 30 seconds and nothing changes. Any ideas?

              console.log("[LOGIN PAGE OPEN after 3 seconds]");
              page.render("image1.png");
              page.evaluate(function(creds) {
                console.log("[CREDS] " + JSON.stringify(creds, undefined, 4));
                $('#login-input-username').val(creds.username);
                $('#login-input-password').val(creds.password);
                $('#login-window form').submit();
              }, function() {
                console.log("[CHECK LOGIN]");
                page.render("image2.png");

image2

jcott28 commented 9 years ago

Having the same problem. Which OS are you using?

technobly commented 9 years ago

OSX 10.10.5 Yosemite I have PhantomJS 2.0.0 installed via Homebrew Was using NodeJS v0.10.33 for above results

Now that I just upgraded to NodeJS v4.2.1 I'm not getting anything to work past were it says [LOGIN]. See the 3 trace logs here, only [LOGIN] is visible now. I used to get all of the way through the .login function in the past.

DubtrackAPI.prototype.login = function() {
      console.log("[LOGIN]");
      var self = this;
      this.createPage(function(ph) {
        console.log("[CREATE PAGE - THIS]");
        self.ph = ph;
        self.ph.createPage(function (page) {
          console.log("[CREATE PAGE - SELF]");
technobly commented 9 years ago

Ok just ran these again in the bot directory, for some reason that made it work again. And by work I just mean it runs through and gives me the Tried to login but was not successful. error again. Here's my trace:

[LOGIN]
[CREATE PAGE - THIS]
[CREATE PAGE - SELF]
[LOGIN PAGE OPEN]
Resource requested..
Loading started
Resource requested..
Resource requested..
Resource requested..
Resource requested..
Resource requested..
Resource requested..
Resource requested..
Resource requested..
Resource received!
Resource received!
Resource received!
Resource received!
Resource received!
Resource received!
Resource received!
Resource received!
Resource requested..
Resource requested..
Resource received!
Resource received!
Resource requested..
Resource requested..
Resource received!
Resource requested..
Resource requested..
Resource requested..
Resource requested..
Resource requested..
Resource requested..
Resource requested..
Resource requested..
Resource requested..
Resource requested..
Resource received!
Resource requested..
Resource received!
Resource received!
Resource received!
Resource requested..
Resource received!
Resource received!
Resource received!
Resource received!
Resource received!
Resource received!
Resource received!
Resource received!
Resource requested..
Resource received!
Resource requested..
Resource received!
Resource received!
Resource received!
Loading finished
[LOGIN PAGE OPEN 1]success
[LOGIN PAGE OPEN after 3 seconds]
[CREDS] {
    "username": "myusername",
    "password": "mypassword"
}
[CHECK LOGIN]
Resource requested..
Loading started
Resource requested..
Resource requested..
Resource requested..
Resource received!
Resource requested..
Resource requested..
Resource received!
Resource received!
Resource received!
Resource received!
Loading finished
Resource received!
Tried to login but was not successful. Sorry.
technobly commented 9 years ago

So I just installed everything on Windows 8.1 Pro and it works. It did not work with an older version of NodeJS though. Sucks that you have to install 8GB worth of MS Visual Studio Crap (which I can probably delete now)... but interesting that it works there and not on Mac. I followed these steps: https://github.com/atomjack/dubtrackapi/issues/13#issuecomment-148935066

Here's my login screens now on Windows: image1

image2

I'm guessing something with PhantomJS is not working... but unsure how to debug it.

technobly commented 9 years ago

More testing on Windows vs Mac I ran a native PhantomJS app and got the same halfway loaded Login screen on Mac, but it works on Windows.

load.js

var page = require('webpage').create();
page.viewportSize = {
  width: 1280,
  height: 720
};
page.open('https://www.dubtrack.fm/login', function(status) {
  console.log("Status: " + status);
  if(status === "success") {
    page.render('example1.png');
  }
  setTimeout(function(){
    page.render('example2.png');
    phantom.exit();
  },3000);
});

Run with:

phantomjs load.js

Output:

Status: success

example1.png Windows (initial page load)

example

example2.png Windows (this is after 3 seconds of waiting)

example2


example1.png Mac (initial page load)

example

example2.png Mac (even waiting 20 seconds doesn't change anything)

example

jcott28 commented 9 years ago

Exactly the same setup here and exactly the same output. Clearly an issue with OSX. I worked on this, same as you appear to have, for hours upon hours, but to no avail. Sadly, I'm not sure how to debug further (I finally hit that poing where I was making no progress or gaining any new info).

technobly commented 9 years ago

Submitted an issue to the PhantomJS repo: https://github.com/ariya/phantomjs/issues/13696

atomjack commented 9 years ago

Thanks @technobly. I've subscribed to that issue. Hopefully they'll have a fix or some suggestions.