mifi / instauto

Instagram bot / automation library written in Javascript for Node.js
799 stars 145 forks source link

Error: No node found for selector: a[href="/accounts/login/"] #4

Closed balazsnemeth closed 5 years ago

balazsnemeth commented 5 years ago

(Mac Osx Mojave) Installed the dependencies, added the example.js based on your example, filled out my users, however when I tried to execute I got this error:

Macs-MacBook-Pro:instafollow mysecretuser$ node example.js 
Failed to load cookies
Failed to load followed db
Failed to load unfollowed db
Error: No node found for selector: a[href="/accounts/login/"]
    at assert (/Users/mysecretuser/Work/projects/digitalNomad/instafollow/node_modules/puppeteer/lib/helper.js:270:11)
    at DOMWorld.click (/Users/mysecretuser/Work/projects/digitalNomad/instafollow/node_modules/puppeteer/lib/DOMWorld.js:366:5)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  -- ASYNC --
    at Frame.<anonymous> (/Users/mysecretuser/Work/projects/digitalNomad/instafollow/node_modules/puppeteer/lib/helper.js:111:15)
    at Page.click (/Users/mysecretuser/Work/projects/digitalNomad/instafollow/node_modules/puppeteer/lib/Page.js:1031:29)
    at module.exports (/Users/mysecretuser/Work/projects/digitalNomad/instafollow/node_modules/instauto/index.js:464:16)
    at process._tickCallback (internal/process/next_tick.js:68:7)
Closing browser
balazsnemeth commented 5 years ago

I probably need to fork your repo and update the HTML elem identifiers.

Like this issue is gone if I change line 464 in instaauto/index.js to await page.click('a[href="/accounts/login/?source=auth_switcher"]'); from await page.click('a[href="/accounts/login/]');

But now there are new errors:

TypeError: Cannot read property 'click' of undefined
    at module.exports (/Users/nbalazs/Work/projects/digitalNomad/instafollow/node_modules/instauto/index.js:471:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
mifi commented 5 years ago

Thanks for reporting! I have now fixed this in the latest version. Currently it seems that the first time we log in there is an error about "Suspicious login activity". This needs to be handled manually with "headless = false". When this is solved, the cookie will be stored in cookies.json and the error should not appear again.