Instapy: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//div[text()='Followers' or text()='Following']/../../following-sibling::div"}

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

@converge @timgrossmann @sionking @uluQulu

Traceback (most recent call last):
File "/root/InstaPy/5bfe91a9b72ae70014ad931a.py", line 24, in
session.interact_user_followers(['bowles','ecom_mentor','youngwithambition','rickygutierrezz','ecomwolf'], amount=70, randomize=True)
File "/root/InstaPy/instapy/instapy.py", line 2596, in interact_user_followers
self.logfolder)
File "/root/InstaPy/instapy/unfollow_util.py", line 884, in get_given_user_followers
channel, jumps, logger, logfolder)
File "/root/InstaPy/instapy/unfollow_util.py", line 651, in get_users_through_dialog
dialog = browser.find_element_by_xpath(dialog_address)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
'value': value})['value']
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-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.77)
(Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.15.0-39-generic x86_64)

Most helpful comment

    # 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)

All 26 comments

same here from follow_user_followers

I have the same error too from session.follow_user_followers

same here

Traceback (most recent call last):
File "quickstart.py", line 28, in
session.follow_user_followers(['example'], amount=10, randomize=False)
File "/home/zartas/InstaPy/instapy/instapy.py", line 2907, in follow_user_followers
self.logfolder)
File "/home/zartas/InstaPy/instapy/unfollow_util.py", line 884, in get_given_user_followers
channel, jumps, logger, logfolder)
File "/home/zartas/InstaPy/instapy/unfollow_util.py", line 651, in get_users_through_dialog
dialog = browser.find_element_by_xpath(dialog_address)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
'value': value})['value']
File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.6/dist-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: chrome=70.0.3538.110)
(Driver info: chromedriver=2.44.609551 (5d576e9a44fe4c5b6a07e568f1ebc753f1214634),platform=Linux 4.15.0-39-generic x86_64)
try to build with pip3.6 also run with python3.6 quickstart.py tried installing & running with 2.7 same error

same here.

i have this same error what is happening?

Some one can fix it ??

Oh god I'm not alone.

Yep, same here. I guess it happened for everyone :)

    # 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)

@sionking i already did this and isnt working

after what happend today i advice everyone to hurry up and get as many follows as you all can because this is just too cute to be true and it can end at any time. today is a good example. i did a mistake by taking my time and taking it easy. now if i get to fix this i will hurry up and get my followers to where i want them( at least 11k im at 8k)

@Banginpadr it's just a change in the html maded by an update from instagram ... and the solutions provided works for me ... there is no need to alarm anyone.

@ilmetu you are not getting my point. im not alarming anyone im saying it how it is. this tool is heaven and as anything good it can always end thats all. why are you talking it to the heart? is not like im wishing it since im using.

@sionking thanks, will try that now.

then some solution to fix it ?

@sergiosre @sionking sent this solution and it seems to work:

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)

@fgisslen where i need to modify this?

@sergiosre in instapy/unfollow_util.py

i get this now:

Traceback (most recent call last):
File "ttt-follow-unfollow.py", line 1, in
from instapy import InstaPy
File "/home//InstaPy/instapy/__init__.py", line 3, in
from .instapy import InstaPy
File "/home/
/InstaPy/instapy/instapy.py", line 28, in
from .like_util import check_link
File "/home//InstaPy/instapy/like_util.py", line 18, in
from .unfollow_util import get_following_status
File "/home/
/InstaPy/instapy/unfollow_util.py", line 406
dialog = browser.find_element_by_xpath(dialog_address)
^
IndentationError: unexpected indent

@Tr1pke there is a very nice message for you there :)
^
IndentationError: unexpected indent

    # 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)

worked perfectly for me. thank you for such a prompt help, @sionking!

For me doesn't work , it throws invalid syntax...

@sergiosre if you write it correct it will work.
Write it with indentation..

work but throw the same error

its working, i didn't add the 'try:' on top
thanks !

and its the _second_ #find dialog box, not the first

# 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)_

Still throwing the same error:


INFO [2018-11-30 18:40:40] [xxx] Starting to unfollow users..
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
INFO [2018-11-30 18:40:40] [xxx] Unfollowing the users you are following
INFO [2018-11-30 18:42:43] [xxx] Too many requests sent! attempt: 1 | gathered links: 1080
~sleeping a bit
INFO [2018-11-30 18:54:32] [xxx] Too many requests sent! attempt: 2 | gathered links: 2136
~sleeping a bit
ERROR [2018-11-30 19:13:48] [xxx] Sorry, an error occurred: Message: no such element: Unable to
locate element: {"method":"xpath","selector":"//div[text()='Following']/../../following-sibling::di
v"}
(Session info: chrome=70.0.3538.110)
(Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows
NT 6.1.7601 SP1 x86_64)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

deronsizemore picture deronsizemore  路  3Comments

neomh picture neomh  路  3Comments

n0sw34r picture n0sw34r  路  3Comments

ghost picture ghost  路  3Comments

tibor picture tibor  路  3Comments