Instapy: Stuck at "Cookie file not found, creating cookie..."

Created on 12 Nov 2020  路  14Comments  路  Source: timgrossmann/InstaPy

Hi guys!
Anyone could help me with an issue? Im quite sure its a very common trouble, but i cant seam to fix it :frowning:
I run the script but i get stuck in "Cookie file not found, creating cookie..." and then it crashes :frowning:

This is what i get:

`WARNING [2020-11-12 08:28:59] [USERNAME] Cookie file not found, creating cookie...
INFO [2020-11-12 08:29:41] [USERNAME] Timed out with failure while explicitly waiting until visibility of element located!


If raising an issue, please also upload the file located at:
C:\Users\user\AppData\Local\Temp20201112-082946.html


INFO [2020-11-12 08:29:46] [USERNAME] Sessional Live Report:
|> No any statistics to show

[Session lasted 57.04 seconds]
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2020-11-12 08:29:46] [USERNAME] Session ended!
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

Traceback (most recent call last):
File ".\instapytest.py", line 23, in
with smart_run(session):
File "C:\Python37\lib\contextlib.py", line 114, in __enter__
raise RuntimeError("generator didn't yield") from None
RuntimeError: generator didn't yield`

in progress

Most helpful comment

Hi,
I stumbled upon this issue today.

The problem is that Instagram added a second Cookie Accept button after the first one when you open instagram for the first time (without cookies), and this wasn't handled in the current code (I'm using InstaPy 0.6.12).

For a quick fix you can add this line:
browser.find_element_by_xpath("/html/body/div[2]/div/div/div/div[2]/button[1]").click()

in login_util.py:269 after the if cookie_loaded: statement.

I wanted to open a PR, but if I'm not mistaken, I see the issue is already handled by PR#5894

All 14 comments

I have the same issue on Ubutu 18.04.
Everyting work fine till yestarday

Cookies seem to be broken atm. Every time I am starting a session and the bot tries to create a new cookie, the selenium driver crashes. I have to restart the bot until it's not trying to recreate the cookie

Hi,
I stumbled upon this issue today.

The problem is that Instagram added a second Cookie Accept button after the first one when you open instagram for the first time (without cookies), and this wasn't handled in the current code (I'm using InstaPy 0.6.12).

For a quick fix you can add this line:
browser.find_element_by_xpath("/html/body/div[2]/div/div/div/div[2]/button[1]").click()

in login_util.py:269 after the if cookie_loaded: statement.

I wanted to open a PR, but if I'm not mistaken, I see the issue is already handled by PR#5894

Consider using a WebdriverWait or time.sleep before the statement in case your internet connection isn't flawless. :)

For a quick fix you can add this line:
browser.find_element_by_xpath("/html/body/div[2]/div/div/div/div[2]/button[1]").click()

in login_util.py:269 after the if cookie_loaded: statement.

@feelqah Major thank you! After looking around for a fix for about 4 hours, you just saved my mental health! :)

@feelqah @rever92

current version is intended to handle the case cookie does not exist,
actually the intention is not to save the login Info since latter on the cookie will be saved.

1605405086448   webdriver::server   DEBUG   -> POST /session/5b9b9daa-98e64b52057d/element {"using": "xpath", "value": "//*[contains(text(), 'Not Now')]"}
1605405086448   Marionette  DEBUG   0 -> [0,32,"WebDriver:FindElement",{"using":"xpath","value":"//*[contains(text(), 'Not Now')]"}]
Workspace in use: "/Users/internet/GitHub/InstaPy_Info"
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2020-11-14 19:13:43] [internet]  Session started!
oooooooooooooooooooooooooooooooooooooooooooooooooooooo
INFO [2020-11-14 19:13:43] [internet]  -- Connection Checklist [1/2] (Internet Connection Status)
INFO [2020-11-14 19:13:44] [internet]  - Internet Connection Status: ok
INFO [2020-11-14 19:13:44] [internet]  - Current IP is "0.0.0.0" and it's from "AC/DC"
INFO [2020-11-14 19:13:44] [internet]  -- Connection Checklist [2/2] (Hide Selenium Extension)
INFO [2020-11-14 19:13:44] [internet]  - window.navigator.webdriver response: None
INFO [2020-11-14 19:13:44] [internet]  - Hide Selenium Extension: ok
WARNING [2020-11-14 19:13:47] [internet]  Cookie file not found, creating cookie...
INFO [2020-11-14 19:14:02] [internet]  Do not save Login Info by now
...................................................................
INFO [2020-11-14 19:14:09] [internet]  Logged in successfully!
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
INFO [2020-11-14 19:14:09] [internet]  Saving account progress...
INFO [2020-11-14 19:14:24] [internet]  Getting active users who liked the latest 5 posts:
  ~collecting the usernames from posts with the boundary of 500

@feelqah yes, you are right. I am currently working on a fix for this

I was having this same issue. I was using the FireFox browser and found that the cookie message didn't actually pop out, yet the issue still exists. While tracing the execution, I found that the login_user() function within login_util module has the login_state =False even after the account is actually logged in. The dumb fix I did was to get the following if statement to always pass:
'# if login_state is True:
if True:
dismiss_notification_offer(browser, logger)
dissmiss_save_information(browser, logger)
return True

this seems to have fixed my issue. So I'm thinking maybe there are some issues with InstaPy to get the login_state, but I don't know how/why.

In which directory do I need to change the login user function?...

Its not working for me I try all methods mentioned here

Hey, I also still have the problem. Is there any solution available?

No man

Same here. Can't login anymore. Stuck on cookie creation.

Hey, the following solution worked for me: https://github.com/timgrossmann/InstaPy/issues/5834

Was this page helpful?
0 / 5 - 0 ratings