InstaPy icon indicating copy to clipboard operation
InstaPy copied to clipboard

Unfollow Error Xpath

Open cesarcm96 opened this issue 8 years ago • 10 comments


INFO [2018-08-24 19:38:02] [sinmarcamexico] Starting to unfollow users.. """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" INFO [2018-08-24 19:38:03] [sinmarcamexico] Unfollowing the users you are following ERROR [2018-08-24 19:38:30] [sinmarcamexico] Sorry, an error occured: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//div[text()='Followers' or text()='Following']/following-sibling::div"} (Session info: chrome=68.0.3440.106) (Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Windows NT 10.0.17134 x86_64)

OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO INFO [2018-08-24 19:38:35] [sinmarcamexico] Session ended - 2018-08-24 19:38:35 oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

cesarcm96 avatar Aug 25 '18 00:08 cesarcm96

I started having this issue today too. @uluQulu are you able to help? Thank you :)

santhoshraje avatar Aug 25 '18 01:08 santhoshraje

got it also since last 2 hours

mrrobotsca avatar Aug 25 '18 02:08 mrrobotsca

Yep same issue

x225am avatar Aug 25 '18 03:08 x225am

Inside unfollow_util.py I changed:

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

for

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

and it works.

jeffarese avatar Aug 25 '18 07:08 jeffarese

This seemed to have worked for me!

Tachenz avatar Aug 25 '18 08:08 Tachenz

Not for me.

forgottensword avatar Aug 25 '18 08:08 forgottensword

Can you post the exact error that you get when applying my solution?

Because the error you posted on the other thread was impossible to get with my code.

jeffarese avatar Aug 25 '18 09:08 jeffarese

Im still getting this error ❌

INFO [2018-08-25 12:32:46] [user]  Session started!
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooo



.................................................................
INFO [2018-08-25 12:33:23] [user]  Logged in successfully!
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
INFO [2018-08-25 12:33:26] [user]  User 'example' [1/4]
Unable to read VR Path Registry from C:\Users\testing\AppData\Local\openvr\openvrpaths.vrpath
[1164:9808:0825/123333.402:ERROR:latency_info.cc(163)] Display::DrawAndSwap, LatencyInfo vector size 102 is too big.
INFO [2018-08-25 12:33:38] [user]  Failed to load desired amount of users
INFO [2018-08-25 12:33:38] [user]  Simulated follow : 1
INFO [2018-08-25 12:33:46] [user]  --> Followed b'example'
Traceback (most recent call last):
  File "user.py", line 73, in job
    session.interact_user_followers(competitors, amount=randint(140, 190), randomize=True)
  File "C:\Users\testing\Documents\GitHub\InstaPy\instapy\instapy.py", line 1816, in interact_user_followers
    self.logfolder)
  File "C:\Users\testing\Documents\GitHub\InstaPy\instapy\unfollow_util.py", line 910, in get_given_user_followers
    channel, logger, logfolder)
  File "C:\Users\testing\Documents\GitHub\InstaPy\instapy\unfollow_util.py", line 729, in get_users_through_dialog
    person_list = dialog_username_extractor(buttons)
  File "C:\Users\testing\Documents\GitHub\InstaPy\instapy\unfollow_util.py", line 751, in dialog_username_extractor
    if person and hasattr(person, 'text') and person.text:
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 76, in text
    return self._execute(Command.GET_ELEMENT_TEXT)['value']
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 628, in _execute
    return self._parent.execute(command, params)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute
    self.error_handler.check_response(response)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
  (Session info: chrome=68.0.3440.106)
  (Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64)

HCWcoder avatar Aug 25 '18 09:08 HCWcoder

It works. Thanks.

spikeyhair avatar Aug 25 '18 09:08 spikeyhair

Hi @santhoshraje Have a read https://github.com/timgrossmann/InstaPy/issues/2757#issuecomment-415963537 to get the solution.


Cheers 😁

uluQulu avatar Aug 25 '18 12:08 uluQulu