'instapy doesn't login into account

I'm trying to use instapy but I keep getting this error

INFO [2021-08-02 19:24:14] []  -- Connection Checklist [1/2] (Internet Connection Status)
INFO [2021-08-02 19:24:16] []  - Internet Connection Status: ok
INFO [2021-08-02 19:24:16] []  -- Connection Checklist [2/2] (Instagram Server Status)
INFO [2021-08-02 19:24:24] []  - Instagram WebSite Status: Currently Up 
INFO [2021-08-02 19:24:24] []  - Instagram Response Time: 108.423 ms 
INFO [2021-08-02 19:24:24] []  - Instagram Reponse Code: 200
INFO [2021-08-02 19:24:24] []  - Instagram Server Status: ok
Cookie file not found, creating cookie...
Login A/B test detected! Trying another string...

............................................................................................................................
CRITICAL [2021-08-02 19:24:43] []  Unable to login to Instagram! You will find more information in the logs above.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

I install it with pip and pip3 and it doesn't work at all It stoped when instagram asked to accept cookies



Solution 1:[1]

In xpath_compile.py:

Line 159 "login_elem_no_such_exception": "//a[text()='Log``` In']",

It needs to look like this

Line 159 "login_elem_no_such_exception": "//button[text()='Log In']",

You can find the file:

  • on Linux: /usr/local/lib/python3.6/dist-packages/instapy

  • on Windows: E:\Users\(yourprofile)\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\instapy

Source: https://github.com/timgrossmann/InstaPy/issues/4877#issuecomment-522282119

Solution 2:[2]

Calling the class initializer with parameter want_check_browser=False worked for me as following:

session = InstaPy(username="USERNAME", password="PASSWORD", headless_browser=False, want_check_browser=False)

However, it seems like a workaround.

Also, you can check login_util.py line 246 in version 0.6.16, it says,

# Hotfix - this check crashes more often than not -- plus in not necessary,
# I can verify my own connection

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 blackbrandt
Solution 2 OnurD