Instapy: cant get user followers

Created on 30 Nov 2018  路  19Comments  路  Source: timgrossmann/InstaPy


Expected Behavior

user followers will be clicked

Current Behavior

Iam getting exception:

Traceback (most recent call last):
File "D:\InstaPy\quickstart.py", line 117, in
session.follow_user_followers(['wine_spectator'], amount=amount_number, randomize=False, interact=True, sleep_delay=300)
File "D:\InstaPyinstapyinstapy.py", line 2906, in follow_user_followers
self.logfolder)
File "D:\InstaPyinstapy\unfollow_util.py", line 884, in get_given_user_followers
channel, jumps, logger, logfolder)
File "D:\InstaPyinstapy\unfollow_util.py", line 651, in get_users_through_dialog
dialog = browser.find_element_by_xpath(dialog_address)
File "C:\Users\ronmar\AppData\Local\Programs\Python\Python37-32lib\site-packages\selenium-3.141.0-py3.7.egg\selenium\webdriver\remote\webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "C:\Users\ronmar\AppData\Local\Programs\Python\Python37-32lib\site-packages\selenium-3.141.0-py3.7.egg\selenium\webdriver\remote\webdriver.py", line 978, in find_element
'value': value})['value']
File "C:\Users\ronmar\AppData\Local\Programs\Python\Python37-32lib\site-packages\selenium-3.141.0-py3.7.egg\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\ronmar\AppData\Local\Programs\Python\Python37-32lib\site-packages\selenium-3.141.0-py3.7.egg\selenium\webdriver\remote\errorhandler.py", line 242, 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: headless chrome=70.0.3538.110)
(Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Windows NT 10.0.14393 x86_64)

Possible Solution (optional)

InstaPy configuration

# let's go! :>
with smart_run(session):

    # general settings
    session.set_relationship_bounds(enabled=True,
                potency_ratio=None,
                delimit_by_numbers=True,
                max_followers=6000,
                max_following=3000,
                min_followers=30,
                min_following=30)

    # session.set_user_interact(amount=2, randomize=True, percentage=100, media='Photo')

    amount_number=500

    session.set_user_interact(amount=1, randomize=True, percentage=20, media='Photo')

    session.set_do_like(enabled=True, percentage=100)

    session.set_do_comment(enabled=False, percentage=0)

    session.set_do_follow(enabled=False, percentage=0)

    session.follow_user_followers(['wine_spectator'], amount=amount_number, randomize=False, interact=True, sleep_delay=300)


    #session.set_user_interact(amount=2, randomize=True, percentage=100, media='Photo')


    # activity

    #session.interact_user_followers(['user1', 'user2', 'user3'], amount=8000, randomize=True)
    #session.follow_user_followers(['user1', 'user2', 'user3'], amount=8000, randomize=False, interact=True)
    session.unfollow_users(amount=7500, nonFollowers=True, style="RANDOM", unfollow_after=42*60*60, sleep_delay=3)
    session.like_by_tags(['travel', 'traveling', 'photooftheday', 'island', 'letsgoeverywhere', 'backpacker', 'backpackers', 'beautifulplaces', 'traveladdict', 'explore', 'discover', 'lovetotravel', 'enjoyinglife', 'lovetravel'], amount=8000)
wontfix

Most helpful comment

In unfollow_util.py

Temporary replace

dialog = browser.find_element_by_xpath(
        "//div[text()='Followers' or text()='Following']/../../following-sibling::div")

with

dialog = browser.find_element_by_xpath(
        "//div[contains(@class,'isgrP')]")

IT WORKS!
Use this temporarily while wait for the official push by the admin here.

All 19 comments

Same here.

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"x
path","selector":"//div[text()='Followers' or text()='Following']/../../following-sibling::div"}
(Session info: headless chrome=70.0.3538.110)
(Driver info: chromedriver=2.44.609551 (5d576e9a44fe4c5b6a07e568f1ebc753f1214634),platform=Linux 4.15.0-1024-gcp
x86_64)

Same for me.

Traceback (most recent call last):
File ".\followers_of_users.py", line 76, in
session.follow_user_followers(random_targets, amount=random.randint(30,60), randomize=True, sleep_delay=600, interact=True)
File "D:\venv\Lib\site-packagesinstapyinstapy.py", line 2907, in follow_user_followers
self.logfolder)
File "D:\venv\Lib\site-packagesinstapy\unfollow_util.py", line 884, in get_given_user_followers
channel, jumps, logger, logfolder)
File "D:\venv\Lib\site-packagesinstapy\unfollow_util.py", line 651, in get_users_through_dialog
dialog = browser.find_element_by_xpath(dialog_address)
File "D:\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "D:\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 978, in find_element
'value': value})['value']
File "D:\venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "D:\venv\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, 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: headless chrome=70.0.3538.110)
(Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Windows NT 10.0.17134 x86_64)

Did the page layout change again? Similar to https://github.com/timgrossmann/InstaPy/issues/2757#issuecomment-415963537

In unfollow_util.py

Temporary replace

dialog = browser.find_element_by_xpath(
        "//div[text()='Followers' or text()='Following']/../../following-sibling::div")

with

dialog = browser.find_element_by_xpath(
        "//div[contains(@class,'isgrP')]")

IT WORKS!
Use this temporarily while wait for the official push by the admin here.

In unfollow_util.py

Temporary replace

dialog = browser.find_element_by_xpath(
        "//div[text()='Followers' or text()='Following']/../../following-sibling::div")

with

dialog = browser.find_element_by_xpath(
        "//div[contains(@class,'isgrP')]")

IT WORKS!
Use this temporarily while wait for the official push by the admin here.

IT WORKS !

@uluQulu Can you check please? I have the same issue but the temporary solution suggested doesn't work for me
thanks

i better use:

    # find dialog box
    try:
        dialog_address = "//div[text()='Followers' or text()='Following']/../../following-sibling::div"
        dialog = browser.find_element_by_xpath(dialog_address)
    except NoSuchElementException:
        dialog_address = "//div[contains(@class,'isgrP')]"
        dialog = browser.find_element_by_xpath(dialog_address)

2 of them are not working for me :( some help please驴?

Both types do not work for me either.

Guys, stop whining and start providing error codes / messages. Else we don't know what problem u r facing.

Traceback (most recent call last):
File "sergio.py", line 47, in
amount=ammount_number, randomize=False, interact=True, sleep_delay=240)
File "/Users/x/Documents/Instagram/InstaPy-master 6/instapy/instapy.py", line 2839, in follow_user_followers
self.logfolder)
File "/Users/x/Documents/Instagram/InstaPy-master 6/instapy/unfollow_util.py", line 884, in get_given_user_followers
channel, jumps, logger, logfolder)
File "/Users/x/Documents/Instagram/InstaPy-master 6/instapy/unfollow_util.py", line 651, in get_users_through_dialog
dialog = browser.find_element_by_xpath(dialog_address)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 393, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 966, in find_element
'value': value})['value']
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 320, in execute
self.error_handler.check_response(response)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, 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: headless chrome=70.0.3538.110)
(Driver info: chromedriver=2.41.578706 (5f725d1b4f0a4acbf5259df887244095596231db),platform=Mac OS X 10.14.0 x86_64)

Thank you @silensinator . Finally it works. The problem was that I had to replace both

dialog = browser.find_element_by_xpath(
        "//div[text()='Followers' or text()='Following']/../../following-sibling::div")

for it to work. In the first attempt I had only exchanged a part.

Ya, there are two areas. Anyway the official fix should be coming soon where they uses "//div[3]/div/div/div[2]" someone already created a PR

Finally got it working, thanks! I didn't realize there's two parts in the unfollow_util file where I needed to make this change. Initially I only made the change under the first find dialog box comment. Changed code under the second find dialog box comment and now it is working.

can someone uoload a corrected file? still cannot get it to run properly

Making those two changes gets it working for me.

In unfollow_util.py

Temporary replace

dialog = browser.find_element_by_xpath(
        "//div[text()='Followers' or text()='Following']/../../following-sibling::div")

with

dialog = browser.find_element_by_xpath(
        "//div[contains(@class,'isgrP')]")

IT WORKS!
Use this temporarily while wait for the official push by the admin here.

worked for me

thank you guys so much!

dialog = browser.find_element_by_xpath(
        "//div[contains(@class,'isgrP')]")

worked for me as well!

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

Guys, got same problem but... I can't figure out how to fix it...
I'll leave you some screenshot about the problem and the code:

Cattura_nuova_inst_2
Cattura_nuova_inst_3

I know it's something about the div class but... I can't figure out what is the correct one. So maybe this screen might help?

Cattura_nuova_inst_4

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ediooo picture ediooo  路  3Comments

Naramsim picture Naramsim  路  3Comments

wyvers picture wyvers  路  3Comments

harrypython picture harrypython  路  3Comments

rahulkapoor90 picture rahulkapoor90  路  3Comments