Hi,
i was trying to setup Instapy on DigitalOcean in headless mode but it always stopped with the info Unable to login to Instagram! You will find more information in the logs above..
Ive tried a couple of solutions you can find in the Issues section of this repo but nothing worked out for me.
So I debugged Instapy locally with headless_browser=False and it turned out it always stopped at the "Save login" window. I think this window is not configured in the selenium workflow?

Has anyone noticed the same problem?
Edit: After clicking "Not now" manually it worked fine.
I have the same error launching the bot through my RaspBi3+
InstaPy Version: 0.6.3
._. ._. ._. ._. ._. ._. ._.
Workspace in use: "/root/InstaPy"
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2019-09-08 18:13:45] [xxx] Session started!
oooooooooooooooooooooooooooooooooooooooooooooooooooooo
INFO [2019-09-08 18:13:45] [xxx] -- Connection Checklist [1/3] (Internet Connection Status)
INFO [2019-09-08 18:13:46] [xxx] - Internet Connection Status: ok
INFO [2019-09-08 18:13:46] [xxx] - Current IP is "x.x.x.x" and it's from "xxx"
INFO [2019-09-08 18:13:46] [xxx] -- Connection Checklist [2/3] (Instagram Server Status)
INFO [2019-09-08 18:13:59] [xxx] - Instagram WebSite Status: Currently Up
INFO [2019-09-08 18:13:59] [xxx] - Instagram Response Time: 34.407 ms
INFO [2019-09-08 18:13:59] [xxx] - Instagram Reponse Code: 200
INFO [2019-09-08 18:13:59] [xxx] - Instagram Server Status: ok
INFO [2019-09-08 18:13:59] [xxx] -- Connection Checklist [3/3] (Hide Selenium Extension)
INFO [2019-09-08 18:13:59] [xxx] - window.navigator.webdriver response: False
INFO [2019-09-08 18:13:59] [xxx] - Hide Selenium Extension: ok
Cookie file not found, creating cookie...
.........................................................................................................................
CRITICAL [2019-09-08 18:14:40] [xxx] Unable to login to Instagram! You will find more information in the logs above.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
INFO [2019-09-08 18:14:42] [xxx] Sessional Live Report:
|> No any statistics to show
[Session lasted 1.12 minutes]
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2019-09-08 18:14:42] [xxx] Session ended!
oooooooooooooooooooooooooooooooooooooooooooooooooooooooo
[Errno 2] No such file or directory: '/tmp/tmp8av5xdxy'
INFO [2019-09-08 18:14:42] [xxx] Sessional Live Report:
|> No any statistics to show
[Session lasted 1.12 minutes]
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2019-09-08 18:14:42] [xxx] Session ended!
oooooooooooooooooooooooooooooooooooooooooooooooooooooooo
same problem as you, @Jostino :/
Same Problem Here
I had the same error, I solved the problem with 2 lines of code, here:
if "instagram.com/accounts/onetap" in browser.current_url:
browser.get("https://instagram.com")
Under line 446, add it as you see in the photo. (login_util.py)
https://i.ibb.co/b2LgbJX/python.png
Simple as that :)
I had the same error, I solved the problem with 2 lines of code, here:
if "instagram.com/accounts/onetap" in browser.current_url: browser.get("https://instagram.com")Under line 446, add it as you see in the photo. (login_util.py)
https://i.ibb.co/b2LgbJX/python.pngSimple as that :)
I have check it but it doesn't work. Which IntsaPy version do you use?
I had the same error, I solved the problem with 2 lines of code, here:
if "instagram.com/accounts/onetap" in browser.current_url: browser.get("https://instagram.com")Under line 446, add it as you see in the photo. (login_util.py)
https://i.ibb.co/b2LgbJX/python.png
Simple as that :)I have check it but it doesn't work. Which IntsaPy version do you use?
Would you send me a screenshot from where you wrote the code?
Actually I have this situation:
find / -type f -name "login_util.py"
/root/.local/lib/python3.7/site-packages/instapy/login_util.py
/root/.local/lib/python3.5/site-packages/instapy/login_util.py
/usr/local/lib/python2.7/dist-packages/instapy/login_util.py
/usr/local/lib/python3.5/dist-packages/instapy/login_util.py
I've added the lines you mentioned in all these files, just to be sure.
It works!!
But now I have a different issue...
Actually I have this situation:
find / -type f -name "login_util.py" /root/.local/lib/python3.7/site-packages/instapy/login_util.py /root/.local/lib/python3.5/site-packages/instapy/login_util.py /usr/local/lib/python2.7/dist-packages/instapy/login_util.py /usr/local/lib/python3.5/dist-packages/instapy/login_util.pyI've added the lines you mentioned in all these files, just to be sure.
It works!!
But now I have a different issue...
Please give me more details..
I had the same problem and the code you suggested seems to have fixed it.
But I don't know why now my script runs so slow. It's been stuck here for about 10 minutes:
Logged in successfully!
Saving account progress...
WARNING [2019-09-09 13:41:54] [XXX] Unable to save account progress, skipping data update Message: TypeError: window._sharedData is undefined
Edit: After a few minutes the bot started interacting but as I said, is very very slow. My all Raspberry is sluggish while I run the script (which I haven't changed at all since the last update). And I seem to get this error too much frequently: cannot get the post profile pic url
After a reboot and a second attempt, this is what I get:
INFO [2019-09-09 13:59:10] [XXX] Getting XXX image list...
Traceback (most recent call last):
File "/home/pi/InstaPy/z_instabot.py", line 328, in interact_by
randomize=True)
File "/home/pi/.local/lib/python3.7/site-packages/instapy/instapy.py", line 5540, in interact_by_comments
self.user_interact_media,
File "/home/pi/.local/lib/python3.7/site-packages/instapy/instapy.py", line 2471, in interact_by_users
media,
File "/home/pi/.local/lib/python3.7/site-packages/instapy/like_util.py", line 450, in get_links_for_username
browser, "profile", username, person, None, logger, logfolder
File "/home/pi/.local/lib/python3.7/site-packages/instapy/unfollow_util.py", line 211, in get_following_status
following_status = follow_button.text
File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py", line 76, in text
return self._execute(Command.GET_ELEMENT_TEXT)['value']
File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.StaleElementReferenceException: Message: The element reference of <button class="_5f5mN jIbKX _6VtSN yZn4P "> is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed
I had the same error, I solved the problem with 2 lines of code, here:
if "instagram.com/accounts/onetap" in browser.current_url: browser.get("https://instagram.com")Under line 446, add it as you see in the photo. (login_util.py)
https://i.ibb.co/b2LgbJX/python.png
Simple as that :)I have check it but it doesn't work. Which IntsaPy version do you use?
Would you send me a screenshot from where you wrote the code?
Where's my fault? Thanks!
https://ibb.co/Ldsy60R
I had the same problem and the code you suggested seems to have fixed it.
But I don't know why now my script runs so slow. It's been stuck here for about 10 minutes:
Logged in successfully! Saving account progress... WARNING [2019-09-09 13:41:54] [XXX] Unable to save account progress, skipping data update Message: TypeError: window._sharedData is undefinedEdit: After a few minutes the bot started interacting but as I said, is very very slow. My all Raspberry is sluggish while I run the script (which I haven't changed at all since the last update). And I seem to get this error too much frequently:
cannot get the post profile pic urlAfter a reboot and a second attempt, this is what I get:
INFO [2019-09-09 13:59:10] [XXX] Getting XXX image list... Traceback (most recent call last): File "/home/pi/InstaPy/z_instabot.py", line 328, in interact_by randomize=True) File "/home/pi/.local/lib/python3.7/site-packages/instapy/instapy.py", line 5540, in interact_by_comments self.user_interact_media, File "/home/pi/.local/lib/python3.7/site-packages/instapy/instapy.py", line 2471, in interact_by_users media, File "/home/pi/.local/lib/python3.7/site-packages/instapy/like_util.py", line 450, in get_links_for_username browser, "profile", username, person, None, logger, logfolder File "/home/pi/.local/lib/python3.7/site-packages/instapy/unfollow_util.py", line 211, in get_following_status following_status = follow_button.text File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py", line 76, in text return self._execute(Command.GET_ELEMENT_TEXT)['value'] File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute return self._parent.execute(command, params) File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/home/pi/.local/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.StaleElementReferenceException: Message: The element reference of <button class="_5f5mN jIbKX _6VtSN yZn4P "> is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed
Same problem
I've opened an issue here:
https://github.com/timgrossmann/InstaPy/issues/5038
Same problem on login and same problem having everything run slow and crash on my raspberry 3b+
Same problem on 0.6.3 as well
@gdgeyter and @kami4ka di you tried this suggestion?
https://github.com/timgrossmann/InstaPy/issues/5035#issuecomment-529238015
it worked for me about the "unable login...."
Seems like the problem appeared again even with the modifications of the file.
Any others had the same issue again?
INFO [2019-09-12 23:47:45] [username] Session started!
oooooooooooooooooooooooooooooooooooooooooooooooooooooo
INFO [2019-09-12 23:47:45] [username] -- Connection Checklist [1/3] (Internet Connection Status)
INFO [2019-09-12 23:47:46] [username] - Internet Connection Status: ok
INFO [2019-09-12 23:47:46] [username] - Current IP is "x.x.x.x" and it's from "Italy/IT"
INFO [2019-09-12 23:47:46] [username] -- Connection Checklist [2/3] (Instagram Server Status)
INFO [2019-09-12 23:48:00] [username] - Instagram WebSite Status: Currently Up
INFO [2019-09-12 23:48:00] [username] - Instagram Response Time: 37.412 ms
INFO [2019-09-12 23:48:00] [username] - Instagram Reponse Code: 200
INFO [2019-09-12 23:48:00] [username] - Instagram Server Status: ok
INFO [2019-09-12 23:48:00] [username] -- Connection Checklist [3/3] (Hide Selenium Extension)
INFO [2019-09-12 23:48:00] [username] - window.navigator.webdriver response: False
INFO [2019-09-12 23:48:00] [username] - Hide Selenium Extension: ok
Cookie file not found, creating cookie...
............................................................................................................................
CRITICAL [2019-09-12 23:48:53] [username] Unable to login to Instagram! You will find more information in the logs above.
Seems like the problem appeared again even with the modifications of the file.
Any others had the same issue again?INFO [2019-09-12 23:47:45] [username] Session started! oooooooooooooooooooooooooooooooooooooooooooooooooooooo INFO [2019-09-12 23:47:45] [username] -- Connection Checklist [1/3] (Internet Connection Status) INFO [2019-09-12 23:47:46] [username] - Internet Connection Status: ok INFO [2019-09-12 23:47:46] [username] - Current IP is "x.x.x.x" and it's from "Italy/IT" INFO [2019-09-12 23:47:46] [username] -- Connection Checklist [2/3] (Instagram Server Status) INFO [2019-09-12 23:48:00] [username] - Instagram WebSite Status: Currently Up INFO [2019-09-12 23:48:00] [username] - Instagram Response Time: 37.412 ms INFO [2019-09-12 23:48:00] [username] - Instagram Reponse Code: 200 INFO [2019-09-12 23:48:00] [username] - Instagram Server Status: ok INFO [2019-09-12 23:48:00] [username] -- Connection Checklist [3/3] (Hide Selenium Extension) INFO [2019-09-12 23:48:00] [username] - window.navigator.webdriver response: False INFO [2019-09-12 23:48:00] [username] - Hide Selenium Extension: ok Cookie file not found, creating cookie... ............................................................................................................................ CRITICAL [2019-09-12 23:48:53] [username] Unable to login to Instagram! You will find more information in the logs above.
Before logging in, it redirects you to the challenge page(suspicious login attempt) and the browser closes at that moment?
Seems like the problem appeared again even with the modifications of the file.
Any others had the same issue again?INFO [2019-09-12 23:47:45] [username] Session started! oooooooooooooooooooooooooooooooooooooooooooooooooooooo INFO [2019-09-12 23:47:45] [username] -- Connection Checklist [1/3] (Internet Connection Status) INFO [2019-09-12 23:47:46] [username] - Internet Connection Status: ok INFO [2019-09-12 23:47:46] [username] - Current IP is "x.x.x.x" and it's from "Italy/IT" INFO [2019-09-12 23:47:46] [username] -- Connection Checklist [2/3] (Instagram Server Status) INFO [2019-09-12 23:48:00] [username] - Instagram WebSite Status: Currently Up INFO [2019-09-12 23:48:00] [username] - Instagram Response Time: 37.412 ms INFO [2019-09-12 23:48:00] [username] - Instagram Reponse Code: 200 INFO [2019-09-12 23:48:00] [username] - Instagram Server Status: ok INFO [2019-09-12 23:48:00] [username] -- Connection Checklist [3/3] (Hide Selenium Extension) INFO [2019-09-12 23:48:00] [username] - window.navigator.webdriver response: False INFO [2019-09-12 23:48:00] [username] - Hide Selenium Extension: ok Cookie file not found, creating cookie... ............................................................................................................................ CRITICAL [2019-09-12 23:48:53] [username] Unable to login to Instagram! You will find more information in the logs above.Before logging in, it redirects you to the challenge page(suspicious login attempt) and the browser closes at that moment?
I don't know, this is a py script executed on the CLI inside a rasppi3+, w/o any interfaces.
Seems like the problem appeared again even with the modifications of the file.
Any others had the same issue again?INFO [2019-09-12 23:47:45] [username] Session started! oooooooooooooooooooooooooooooooooooooooooooooooooooooo INFO [2019-09-12 23:47:45] [username] -- Connection Checklist [1/3] (Internet Connection Status) INFO [2019-09-12 23:47:46] [username] - Internet Connection Status: ok INFO [2019-09-12 23:47:46] [username] - Current IP is "x.x.x.x" and it's from "Italy/IT" INFO [2019-09-12 23:47:46] [username] -- Connection Checklist [2/3] (Instagram Server Status) INFO [2019-09-12 23:48:00] [username] - Instagram WebSite Status: Currently Up INFO [2019-09-12 23:48:00] [username] - Instagram Response Time: 37.412 ms INFO [2019-09-12 23:48:00] [username] - Instagram Reponse Code: 200 INFO [2019-09-12 23:48:00] [username] - Instagram Server Status: ok INFO [2019-09-12 23:48:00] [username] -- Connection Checklist [3/3] (Hide Selenium Extension) INFO [2019-09-12 23:48:00] [username] - window.navigator.webdriver response: False INFO [2019-09-12 23:48:00] [username] - Hide Selenium Extension: ok Cookie file not found, creating cookie... ............................................................................................................................ CRITICAL [2019-09-12 23:48:53] [username] Unable to login to Instagram! You will find more information in the logs above.Before logging in, it redirects you to the challenge page(suspicious login attempt) and the browser closes at that moment?
I don't know, this is a py script executed on the CLI inside a rasppi3+, w/o any interfaces.
I still have the same problem.
It is still actual, I downloaded the latest version and got the same error
same Problem!!!
I'm having this problem as well. But mine is popping up Firefox and going to Instagram, so if I click login and type in my credentials to the web browser very quickly, it works. But the automated process of logging into Instagram is not working, no errors, just not logging in at all and trying to carry on with the rest of the script.
I'm also having this problem, only works if you launch the script in a GUI-environment and manually click "Save" or "Not Now" in the webbrowser. Any way this be fixed by editing login_util.py?
Hi guys, I had the same issue, the program do not have enough time to load the page, the code execute the action before the page is loaded, so just type
from time import sleep
sleep(2)
Most helpful comment
I had the same error, I solved the problem with 2 lines of code, here:
Under line 446, add it as you see in the photo. (login_util.py)
https://i.ibb.co/b2LgbJX/python.png
Simple as that :)