Instapy: Unfollow Problem a Day

Created on 16 May 2018  路  5Comments  路  Source: timgrossmann/InstaPy

INFO [2018-05-16 10:14:21] [mr_and_mrs_vfit] Session started - 2018-05-16 10:14:21
INFO [2018-05-16 10:14:56] [mr_and_mrs_vfit] Logged in successfully!
ERROR [2018-05-16 10:15:31] [mr_and_mrs_vfit] following_link error list index out of range


If raising an issue, please also upload the file located at:
/var/folders/3p/8_l8b6t547lbcb1tcsx_vmhm0000gn/T/20180516-101558.html


INFO [2018-05-16 10:15:58] [mr_and_mrs_vfit] Session ended - 2018-05-16 10:15:58
INFO [2018-05-16 10:15:58] [mr_and_mrs_vfit] --------------------

Traceback (most recent call last):
File "unfo.py", line 42, in
session.unfollow_users(amount=1000, onlyNotFollowMe=False, sleep_delay=10)
File "/Users/jonathanverdier/Desktop/InstaPy/instapy/instapy.py", line 1835, in unfollow_users
self.logfolder)
File "/Users/jonathanverdier/Desktop/InstaPy/instapy/unfollow_util.py", line 327, in unfollow
"//div[text()='Following']/following-sibling::div")
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium-2.53.6-py3.6.egg/selenium/webdriver/remote/webdriver.py", line 293, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium-2.53.6-py3.6.egg/selenium/webdriver/remote/webdriver.py", line 752, in find_element
'value': value})['value']
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium-2.53.6-py3.6.egg/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium-2.53.6-py3.6.egg/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.552518 (183d19265345f54ce39cbb94cf81ba5f15905011),platform=Mac OS X 10.13.4 x86_64)

Most helpful comment

Hi @johnvfitness,
I see you are using unfollow_users feature with both methods disabled onlyInstapyFollowed=False and onlyNotFollowMe=False and the third option you do get is unfollowing everybody.
_Are you really sure about that option?_

But anyways, this change will solve your issue:
open up unfollow_util.py file,

find and replace

following_link = browser.find_elements_by_xpath(
    '//article//ul//li[3]')

with

following_link = browser.find_elements_by_xpath(
    '//section//ul//li[3]')

_just replaced article with section_

or even

following_link = browser.find_elements_by_xpath(
    '//li[3]')

Good luck!

All 5 comments

Hi @johnvfitness,
I see you are using unfollow_users feature with both methods disabled onlyInstapyFollowed=False and onlyNotFollowMe=False and the third option you do get is unfollowing everybody.
_Are you really sure about that option?_

But anyways, this change will solve your issue:
open up unfollow_util.py file,

find and replace

following_link = browser.find_elements_by_xpath(
    '//article//ul//li[3]')

with

following_link = browser.find_elements_by_xpath(
    '//section//ul//li[3]')

_just replaced article with section_

or even

following_link = browser.find_elements_by_xpath(
    '//li[3]')

Good luck!

thx bro 馃挴

Please make this fix as a request to commit.

@rodriguesprobr,
I got a huge PR waiting in there :P
Maybe you can PR this?

Still nothing...

Was this page helpful?
0 / 5 - 0 ratings