Instapy: Instagram updated their web page again? (following another users followers

Created on 24 Mar 2018  路  6Comments  路  Source: timgrossmann/InstaPy

Expected Behavior

The code is meant to work and return the amount of users it follows after finding a profile I pick.

Current Behavior

Finds the profile but not the follow element

Compiler:
session = InstaPy(username='User', password='pass')
session.login()
session.follow_user_followers(['michealscott'], amount=500, randomize=False, sleep_delay=1200)
session.end()

Error:
ile "C:\Usersenvyx360\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\selenium\webdriver\remoteerrorhandler.py", line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//div[text()='Followers' or text()='Following']/following-sibling::div"}
(Session info: chrome=65.0.3325.181)
(Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 10.0.16299 x86_64)

Possible Solution (optional)

Where ever the element is stored in instapy and replacing it with the new Instagram elements

My chromedriver is up to date, I've went into other util files and replaced with the current code like in issue #1610

InstaPy configuration

wontfix

Most helpful comment

Make sure you've pulled the latest from master: git pull and post the stacktrace again

All 6 comments

I believe it's because you have to update the chrome driver. Sure you have the last one and you pulled the latest master? https://sites.google.com/a/chromium.org/chromedriver/

Make sure you've pulled the latest from master: git pull and post the stacktrace again

I have the same issue. I use the docker image built from all-in-one docker file. I used the chromedriver 2.38, and the head of master.

INFO [2018-05-01 14:45:55] []  Logged in successfully!
ERROR [2018-05-01 14:46:51] []  following_link error list index out of range
Traceback (most recent call last):
  File "quickstart.py", line 76, in <module>
    session.interact_user_following(target_persion, amount=5, randomize=True)
  File "/InstaPy/instapy/instapy.py", line 1486, in interact_user_following
    self.logger)
  File "/InstaPy/instapy/unfollow_util.py", line 729, in get_given_user_following
    "//div[text()='Following']/following-sibling::div")
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 293, in find_element_by_xpath
    return self.find_element(by=By.XPATH, value=xpath)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 752, in find_element
    'value': value})['value']
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//div[text()='Following']/following-sibling::div"}
  (Session info: chrome=66.0.3359.139)
  (Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Linux 4.9.87-linuxkit-aufs x86_64)

Found my problem. I had some target users have 0 following, or bad user name, or private access. This make the robot unable to handle the page correctly.

Same error but using Instapy on Raspberry Pi 3 using firefox
I figure out that this problem is related to something on the profile, changed to another and the script works
Tried to change the language setting self.switch_language to False in instapy.py but with no success

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this problem still occurs, please open a new issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tibor picture tibor  路  3Comments

converge picture converge  路  3Comments

seuraltimez picture seuraltimez  路  3Comments

v77v picture v77v  路  3Comments

harrypython picture harrypython  路  3Comments