Instapy: New issue after update

Created on 24 Aug 2018  路  79Comments  路  Source: timgrossmann/InstaPy

Expected Behavior

Current Behavior

[0824/090614.981:WARNING:spdy_session.cc(3007)] Received WINDOW_UPDATE for invalid stream 5
[0824/090615.027:WARNING:spdy_session.cc(3007)] Received WINDOW_UPDATE for invalid stream 65
INFO [2018-08-24 09:06:15] [xxx] User xxx[1/4]
INFO [2018-08-24 09:06:23] [xxx] Failed to load desired amount of users
INFO [2018-08-24 09:06:23] [xxx] Simulated follow : 1
INFO [2018-08-24 09:06:25] [xxx] --> Followed b'xxx'
[0824/090626.915:WARNING:spdy_session.cc(3007)] Received WINDOW_UPDATE for invalid stream 9
[0824/090626.922:WARNING:spdy_session.cc(3007)] Received WINDOW_UPDATE for invalid stream 99
[0824/090626.931:WARNING:spdy_session.cc(3058)] Received HEADERS for invalid stream 9
Traceback (most recent call last):
File "thefattouch2.py", line 73, in job
session.interact_user_followers(competitors, amount=randint(140, 190), randomize=True)
File "C:UserstestingDocumentsGitHubInstaPyinstapyinstapy.py", line 1816, in interact_user_followers
self.logfolder)
File "C:UserstestingDocumentsGitHubInstaPyinstapyunfollow_util.py", line 900, in get_given_user_followers
channel, logger, logfolder)
File "C:UserstestingDocumentsGitHubInstaPyinstapyunfollow_util.py", line 719, in get_users_through_dialog
person_list = dialog_username_extractor(buttons)
File "C:UserstestingDocumentsGitHubInstaPyinstapyunfollow_util.py", line 741, in dialog_username_extractor
if person and hasattr(person, 'text') and person.text:
File "C:Program Files (x86)Python37-32libsite-packagesseleniumwebdriverremotewebelement.py", line 76, in text
return self._execute(Command.GET_ELEMENT_TEXT)['value']
File "C:Program Files (x86)Python37-32libsite-packagesseleniumwebdriverremotewebelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "C:Program Files (x86)Python37-32libsite-packagesseleniumwebdriverremotewebdriver.py", line 320, in execute
self.error_handler.check_response(response)
File "C:Program Files (x86)Python37-32libsite-packagesseleniumwebdriverremoteerrorhandler.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: headless chrome=68.0.3440.106)
(Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "thefattouch2.py", line 94, in
job()
File "thefattouch2.py", line 89, in job
except WebDriverException:
NameError: name 'WebDriverException' is not defined

Possible Solution (optional)

InstaPy configuration

session.interact_user_followers(competitors, amount=randint(140, 190), randomize=True)

bug wontfix

Most helpful comment

@uluQulu thank you for looking into this and find the ultimate solution for it. I will be more than happy to CR your PR 馃憤 馃

For others that have similar issue, first please go through the suggested change that @uluQulu mentioned in this thread or please wait for additional PR that will fix this.

All 79 comments

Simillar error after update:

Traceback (most recent call last):
  File "quickstart.py", line 57, in <module>
    sleep_delay=600
  File "/home/ubuntu/InstaPy/instapy/instapy.py", line 2052, in follow_user_followers
    self.logfolder)
  File "/home/ubuntu/InstaPy/instapy/unfollow_util.py", line 900, in get_given_user_followers
    channel, logger, logfolder)
  File "/home/ubuntu/InstaPy/instapy/unfollow_util.py", line 719, in get_users_through_dialog
    person_list = dialog_username_extractor(buttons)
  File "/home/ubuntu/InstaPy/instapy/unfollow_util.py", line 741, in dialog_username_extractor
    if person and hasattr(person, 'text') and person.text:
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 68, in text
    return self._execute(Command.GET_ELEMENT_TEXT)['value']
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 461, in _execute
    return self._parent.execute(command, params)
  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.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
  (Session info: headless chrome=68.0.3440.84)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.4.0-1061-aws x86_64)

@uluQulu please can you take a look into that ?

thanks a lot!

Same here running on ubuntu 64 bit

Can you please post your config as well ?

import os
import time
from tempfile import gettempdir

from selenium.common.exceptions import NoSuchElementException

from instapy import InstaPy

insta_username = ''
insta_password = ''

# set headless_browser=True if you want to run InstaPy on a server

# set these in instapy/settings.py if you're locating the
# library in the /usr/lib/pythonX.X/ directory:
#   Settings.database_location = '/path/to/instapy.db'
#   Settings.chromedriver_location = '/path/to/chromedriver'

session = InstaPy(username=insta_username,
                  password=insta_password,
                  headless_browser=True,
                  multi_logs=True,
                  bypass_suspicious_attempt=False)

try:
    session.login()

    # settings
    amount_number=500

    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=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(['forcecop'], amount=amount_number, randomize=False, interact=True, sleep_delay=300)

except Exception as exc:
    # if changes to IG layout, upload the file to help us locate the change
    if isinstance(exc, NoSuchElementException):
        file_path = os.path.join(gettempdir(), '{}.html'.format(time.strftime('%Y%m%d-%H%M%S')))
        with open(file_path, 'wb') as fp:
            fp.write(session.browser.page_source.encode('utf8'))
        print('{0}\nIf raising an issue, please also upload the file located at:\n{1}\n{0}'.format(
            '*' * 70, file_path))
    # full stacktrace when raising Github issue
    raise

finally:
    # end the bot session
    session.end()

this is really strange, I have the latest version and I just tested it something similar with you configure.

    session.login()

    # settings
    session.set_relationship_bounds(enabled=True,
                 potency_ratio=None,
                  delimit_by_numbers=True,
                   max_followers=45900,
                    max_following=55550,
                     min_followers=1,
                      min_following=1)
    session.set_do_comment(True, percentage=10)
    session.set_comments(['aMEIzing!', 'So much fun!!', 'Nicey!'])
    session.set_dont_include(['friend1', 'friend2', 'friend3'])
    session.set_dont_like(['pizza', 'girl'])
    session.set_do_follow(enabled=True, percentage=1, times=1)
    session.unfollow_users(amount=2, InstapyFollowed=(True, "all"), style="FIFO", unfollow_after=10, sleep_delay=501)
    session.follow_user_followers(['forcecop'], amount=1, randomize=False, interact=True, sleep_delay=300)

    # actions
    session.like_by_tags(['natgeo'], amount=1)

and I'm not getting any error.

I'm wondering if this is some partial DOM change for some users @uluQulu thoughts ?

I'm using the last version, I didn't modify any file, and that's the error I get

Traceback (most recent call last):
  File "gay.py", line 45, in <module>
    session.follow_user_followers(['travelawesome'], amount=amount_number, randomize=False, interact=True, sleep_delay=300)
  File "/root/InstaPy/instapy/instapy.py", line 2052, in follow_user_followers
    self.logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 900, in get_given_user_followers
    channel, logger, logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 719, in get_users_through_dialog
    person_list = dialog_username_extractor(buttons)
  File "/root/InstaPy/instapy/unfollow_util.py", line 741, in dialog_username_extractor
    if person and hasattr(person, 'text') and person.text:
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 68, in text
    return self._execute(Command.GET_ELEMENT_TEXT)['value']
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 461, in _execute
    return self._parent.execute(command, params)
  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.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
  (Session info: headless chrome=68.0.3440.106)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.4.0-131-generic x86_64)

Yes this exactly what i have and i didnt change anything and im running on 2 windows different accounts same error

I've changed config a little bit and problem disappear, but I have new one even more strange https://github.com/timgrossmann/InstaPy/issues/2751

@guar47 what did you change ? also check out my reply https://github.com/timgrossmann/InstaPy/issues/2751#issuecomment-415803647

Sorry for late reply, @HCWcoder, @CharlesCCC
I have had a busy day and I think it is a problem out of the window resizing where the element references become stale possibly cos of DOM changes.

I mean, I am not sure how efficient it will be but do this change to cool the problem for now,
open up unfollow_util.py file and do this change
replace

            except IndexError:
                pass  # Element list is too short to have a [1] element

with

            except IndexError:
                pass  # Element list is too short to have a [1] element
            except StaleElementReferenceException:   # ADD THIS LINE
                print("Heeey! There is a stale element reference here :|\n")   # ADD THIS LINE

###### I think posting the feedback after doing this change will help to bring a stable solution.

Cheers 馃榿

@CharlesCCC I've been thinking it works, but it isn't actually :) Sorry for the wrong info.
@uluQulu Tried to do that. Got the same error :(

Traceback (most recent call last):
  File "quickstart.py", line 47, in <module>
    sleep_delay=600
  File "/home/ubuntu/InstaPy/instapy/instapy.py", line 2052, in follow_user_followers
    self.logfolder)
  File "/home/ubuntu/InstaPy/instapy/unfollow_util.py", line 912, in get_given_user_followers
    channel, logger, logfolder)
  File "/home/ubuntu/InstaPy/instapy/unfollow_util.py", line 729, in get_users_through_dialog
    person_list = dialog_username_extractor(buttons)
  File "/home/ubuntu/InstaPy/instapy/unfollow_util.py", line 751, in dialog_username_extractor
    if person and hasattr(person, 'text') and person.text:
  File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webelement.py", line 68, in text
    return self._execute(Command.GET_ELEMENT_TEXT)['value']
  File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webelement.py", line 461, in _execute
    return self._parent.execute(command, params)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, 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.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.15.0-1020-aws x86_64)

Applied the code, here's the errors

Traceback (most recent call last):
  File "gay.py", line 45, in <module>
    session.follow_user_followers(['travelawesome'], amount=amount_number, randomize=False, interact=True, sleep_delay=300)
  File "/root/InstaPy/instapy/instapy.py", line 2052, in follow_user_followers
    self.logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 901, in get_given_user_followers
    channel, logger, logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 719, in get_users_through_dialog
    person_list = dialog_username_extractor(buttons)
  File "/root/InstaPy/instapy/unfollow_util.py", line 741, in dialog_username_extractor
    if person and hasattr(person, 'text') and person.text:
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 68, in text
    return self._execute(Command.GET_ELEMENT_TEXT)['value']
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 461, in _execute
    return self._parent.execute(command, params)
  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.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
  (Session info: headless chrome=68.0.3440.106)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.4.0-131-generic x86_64)


Ops do this change in there
replace

        if person and hasattr(person, 'text') and person.text:
            try:
                person_list.append(person.find_element_by_xpath("../../../*")
                                   .find_elements_by_tag_name("a")[1].text)
            except IndexError:
                pass  # Element list is too short to have a [1] element

with

        try:   # ADD THIS LINE
            if person and hasattr(person, 'text') and person.text:   # 馃憟馃徏 it fails in here 
                try:
                    person_list.append(person.find_element_by_xpath("../../../*")
                                       .find_elements_by_tag_name("a")[1].text)
                except IndexError:
                    pass  # Element list is too short to have a [1] element
        except StaleElementReferenceException:   # ADD THIS LINE
            print("Heeey! There is a stale element reference here :|\n")   # ADD THIS LINE

You should revert back the previous debug lines in my above comment


Cheers 馃榿

INFO [2018-08-24 18:26:20] [x]  --> Followed b'melinas.photos'
Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|


INFO [2018-08-24 18:26:25] [x]  Grabbed 1 usernames from travelawesome's `Followers` to do following.
INFO [2018-08-24 18:26:25] [x]  User 'melinas.photos' [1/1]
INFO [2018-08-24 18:26:28] [x]  User: melinas.photos >> followers: 1600  |  following: 314  |  relationship ratio: 5.1
INFO [2018-08-24 18:26:28] [x]  ---> melinas.photos has already been followed 1 times
INFO [2018-08-24 18:26:29] [x]  --> Followed total of 0 people

INFO [2018-08-24 18:26:29] [x]  Liked: 0
INFO [2018-08-24 18:26:29] [x]  Already Liked: 0
INFO [2018-08-24 18:26:29] [x]  Commented: 0
INFO [2018-08-24 18:26:29] [x]  Followed: 0
INFO [2018-08-24 18:26:29] [x]  Inappropriate: 0
INFO [2018-08-24 18:26:29] [x]  Not valid users: 0


OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [x] [x]  Session ended - x
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo


``

@uluQulu Now it seems working, but with a lot of messages like Heeey! There is a stale element reference here :|

INFO [2018-08-24 18:25:48] [[email protected]]  User 'melisachristinephotography' [1/1]
INFO [2018-08-24 18:25:51] [[email protected]]  User: melisachristinephotography >> followers: 825  |  following: 1439  |  relationship ratio: 0.57
INFO [2018-08-24 18:25:51] [[email protected]]  melisachristinephotography is not a potential user with the relationship ratio of 0.57  ~skipping user

INFO [2018-08-24 18:25:51] [[email protected]]  Simulated unfollow: 1  ~not valid user
WARNING [2018-08-24 18:25:51] [[email protected]]  --> Unfollowed 'melisachristinephotography' due to Inappropriate Content
INFO [2018-08-24 18:25:51] [[email protected]]   Removed '2018-08-24 18:25 ~ melisachristinephotography ~ 1928085401' from followedPool.csv file
INFO [2018-08-24 18:25:54] [[email protected]]  User 'mariefeandjakesnow' [4/10]
INFO [2018-08-24 18:26:00] [[email protected]]  Simulated follow : 1
INFO [2018-08-24 18:26:02] [[email protected]]  --> Followed b'lina30_05'
Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

:D

Lmao dude that was just to log what's wrong, it's not a fix ahah

@MuccaDiocan anyway it worked

It's clear @guar47
A few questions to get closer to a solution...

  • How much amount you have provided and how many usernames it could get? (_try bigger tests, like amount=100_)
  • How many times does it print that line? always or how frequently?

in my settings, I got amount=500, and I sent you the full log, so 13 times

@uluQulu I have in config amount=10, and it printed 12 times after every user

It means all of the elements are on the fly 馃槀

What is your platform, some kind of Raspberry device?
Also I consider that you have applied the windows resizer fix after scroll blocking update from IG, right?

That information will help to minimize the scope of the problem, but in any case I know what is going on.

@guar47, can you take one more bigger test to be sure that it prints that line every time?

I use EC2 AWS server (last ubuntu). I don't know what windows resizer is :)

@uluQulu Hello, what is that windows resizer fix? I didn't apply nothing yet, and if it's useful I'm running on ubuntu (digital ocean)

I need to make sure what your state is currently.
@guar47 can you share your currently used util.py and unfollow_util.py files?
Also do you use Firefox?

There is a problem with scrollers and windows resizing helps to unblock scroller. It's in another thread.

Also when you have started to get this issue or when you think it popped up?

Hi @uluQulu I use nogui, because as I said it's ubuntu server.
I have the last version of all files because I git pull from scratch yesterday and my last commit the same as on GitHub.

Merge: 9b5c045 c2483d5
Author: Tim Gro脽mann <[email protected]>
Date:   Fri Aug 24 16:08:20 2018 +0200

Except for the changes to unfollow_util.py that we made yesterday within this issue.
The issue appears after the last 3-4 commits as correctly said the title of this issue.
Thank you!

@uluQulu im using windows

what steps should i do ?

Edit :
I did a fresh install this what i got :

.................................................................
INFO [2018-08-25 12:11:30] [xxx]  Logged in successfully!
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
[0825/121134.847:WARNING:spdy_session.cc(3007)] Received WINDOW_UPDATE for invalid stream 67
INFO [2018-08-25 12:11:35] [xxx]  User 'xxxx' [1/4]
Traceback (most recent call last):
  File "xxx.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 648, in get_users_through_dialog
    "//div[text()='Followers' or text()='Following']/following-sibling::div")
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 393, in find_element_by_xpath
    return self.find_element(by=By.XPATH, value=xpath)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 966, in find_element
    'value': value})['value']
  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.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=68.0.3440.106)
  (Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64)


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "xxx.py", line 94, in <module>
    job()
  File "xxx.py", line 89, in job
    except WebDriverException:
NameError: name 'WebDriverException' is not defined
Starting xxx.py
[0825/121206.638:ERROR:gpu_process_transport_factory.cc(1016)] Lost UI shared context.

DevTools listening on ws://127.0.0.1:53346/devtools/browser/5c8b79b7-8ff7-4720-9435-c5633367aeed

my insta code

session = InstaPy(username=insta_username, password=insta_password, multi_logs=True, headless_browser=True , nogui=False)
session.login()
session.set_user_interact(amount=1, randomize=True, percentage=100, media='Photo')
session.set_do_follow(enabled=True, percentage=100)
session.set_do_like(enabled=True, percentage=70)
session.set_delimit_liking(enabled=True, max=120, min=None)
random.shuffle(comments)
session.set_comments(comments)
session.set_do_comment(False, percentage=40)
session.set_delimit_commenting(enabled=True, max=10, min=0)
session.set_dont_include(friendzy)
session.set_ignore_users(friendzy)
session.interact_user_followers(competitors, amount=randint(140, 190), randomize=True)

and i fixed the 2 xpath in issue : #2757

still have this :

.................................................................
INFO [2018-08-25 13:38:52] [user]  Logged in successfully!
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
[0825/133911.072:WARNING:spdy_session.cc(3007)] Received WINDOW_UPDATE for invalid stream 1
INFO [2018-08-25 13:39:11] [user]  User 'user' [1/4]
INFO [2018-08-25 13:39:18] [user]  Failed to load desired amount of users
INFO [2018-08-25 13:39:18] [user]  Simulated follow : 1
INFO [2018-08-25 13:39:20] [user]  --> Followed b'userexample'
Traceback (most recent call last):
  File "userexample.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: headless chrome=68.0.3440.106)
  (Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64)

I'm using windows and I correct the same problem of #2754 but now I note able to load more than 9-12 peoples in interact_user_followers.

I have already made changes proposed in #2725.
I think they change again the scroll :/

@uluQulu

when im trying to add the except from your comment

this is my edit :
image

i get this output :


Traceback (most recent call last):
  File "xxx.py", line 1, in <module>
    from instapy import InstaPy
  File "C:\Users\testing\Documents\GitHub\InstaPy\instapy\__init__.py", line 2, in <module>
    from .instapy import InstaPy
  File "C:\Users\testing\Documents\GitHub\InstaPy\instapy\instapy.py", line 44, in <module>
    from .unfollow_util import get_given_user_followers
  File "C:\Users\testing\Documents\GitHub\InstaPy\instapy\unfollow_util.py", line 757
    except StaleElementReferenceException:
                                         ^

@HCWcoder seems you forgot try: on line 750?

ops 馃槉
scroller is fixed @raulrosa89 @sionking @CharlesCCC @ilmetu

@uluQulu where I can find the fix?

@HCWcoder @guar47 @MuccaDiocan
Can you verify that problem- StaleElementReferenceExeption is fixed since the scroller has been fixed?

@MuccaDiocan, it has been fixed by the IG side. Now it scrolls through the dialog boxes smoothly.

File "gay.py", line 45, in <module>
    session.follow_user_followers(['travelawesome'], amount=amount_number, randomize=False, interact=True, sleep_delay=300)
  File "/root/InstaPy/instapy/instapy.py", line 2052, in follow_user_followers
    self.logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 900, in get_given_user_followers
    channel, logger, logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 638, in get_users_through_dialog
    "//div[text()='Followers' or 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()='Followers' or text()='Following']/following-sibling::div"}
  (Session info: headless chrome=68.0.3440.106)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.4.0-131-generic x86_64)

Applied both #2725 and #2754

@MuccaDiocan it Fixed in #2757
"//div[text()='Followers' or text()='Following']/following-sibling::div")
to
"//div[text()='Followers' or text()='Following']")

image
already applied that, seems to not work?

@MuccaDiocan you did it Wrong , you should do it on line 648, Search //div[text()='Followers' or text()='Following']/following-sibling::div and replace it with"//div[text()='Followers' or text()='Following']")

also back your wrong change to original .

INFO [2018-08-25 11:45:09] [x]  Failed to load desired amount of users
INFO [2018-08-25 11:45:09] [x]  Simulated follow : 1
INFO [2018-08-25 11:45:12] [x]  --> Followed b'musingsofatravelista'
Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|

Heeey! There is a stale element reference here :|


INFO [2018-08-25 11:45:15] [x]  Grabbed 1 usernames from travelawesome's `Followers` to do following.
INFO [2018-08-25 11:45:15] [x]  User 'musingsofatravelista' [1/1]
INFO [2018-08-25 11:45:18] [x]  User: musingsofatravelista >> followers: 2911  |  following: 656  |  relationship ratio: 4.44
INFO [2018-08-25 11:45:18] [x]  ---> musingsofatravelista has already been followed 1 times
INFO [2018-08-25 11:45:19] [x]  --> Followed total of 0 people

INFO [2018-08-25 11:45:19] [x]  Liked: 0
INFO [2018-08-25 11:45:19] [x]  Already Liked: 0
INFO [2018-08-25 11:45:19] [x]  Commented: 0
INFO [2018-08-25 11:45:19] [x]  Followed: 0
INFO [2018-08-25 11:45:19] [x]  Inappropriate: 0
INFO [2018-08-25 11:45:19] [x]  Not valid users: 0


OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2018-08-25 11:45:19] [x]  Session ended - 2018-08-25 11:45:19
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

Ok done, now I get this error

Hey @Mehran
It will not work.
Try this instead- https://github.com/timgrossmann/InstaPy/issues/2757#issuecomment-415963537.


Cheers 馃榿


Traceback (most recent call last):
  File "gay.py", line 45, in <module>
    session.follow_user_followers(['travelawesome'], amount=amount_number, randomize=False, interact=True, sleep_delay=300)
  File "/root/InstaPy/instapy/instapy.py", line 2052, in follow_user_followers
    self.logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 900, in get_given_user_followers
    channel, logger, logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 661, in get_users_through_dialog
    scroll_bottom(browser, dialog, 2)
  File "/root/InstaPy/instapy/util.py", line 429, in scroll_bottom
    "arguments[0].scrollTop = arguments[0].scrollHeight", element)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 465, in execute_script
    'args': converted_args})['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.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
  (Session info: headless chrome=68.0.3440.106)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.4.0-131-generic x86_64)

I applied
https://github.com/timgrossmann/InstaPy/issues/2757#issuecomment-415963537
and #2725

Since the scroller has been fixed, you don't need #2725 and it should be avoided.

changed back to original the #2725
thats the error i get


Traceback (most recent call last):
  File "gay.py", line 45, in <module>
    session.follow_user_followers(['travelawesome'], amount=amount_number, randomize=False, interact=True, sleep_delay=300)
  File "/root/InstaPy/instapy/instapy.py", line 2052, in follow_user_followers
    self.logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 900, in get_given_user_followers
    channel, logger, logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 661, in get_users_through_dialog
    scroll_bottom(browser, dialog, 2)
  File "/root/InstaPy/instapy/util.py", line 426, in scroll_bottom
    "arguments[0].scrollTop = arguments[0].scrollHeight", element)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 465, in execute_script
    'args': converted_args})['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.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
  (Session info: headless chrome=68.0.3440.106)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.4.0-131-generic x86_64)

Hey @CharlesCCC I have realized the source of the problem.
After your workon getting user ID, it now navigates to the user's profile page and then returns back history.go(-1).
That's where the problem lies cos at that moment the references are died and needs to be declared again.

@HCWcoder, @guar47 the problem is solved. I WILL write a few lines for you now to apply the fix.


Cheers 馃榿

To solve StaleElementReferenceExeption, do this
open up unfollow_util.py file,
1-) replace

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

with

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

2-) replace

                    simulated_list.extend(quick_follow)

with

                    simulated_list.extend(quick_follow)
                    # declare the dialog box once again after the DOM change
                    dialog = browser.find_element_by_xpath(dialog_address)

I assume you have applied the changes in my previous https://github.com/timgrossmann/InstaPy/issues/2757#issuecomment-415963537.


Cheers 馃榿

Thanks for the help, however i'm still getting an error:

Traceback (most recent call last):
```
File "gay.py", line 45, in
session.follow_user_followers(['travelawesome'], amount=amount_number, randomize=False, interact=True, sleep_delay=300)
File "/root/InstaPy/instapy/instapy.py", line 2052, in follow_user_followers
self.logfolder)
File "/root/InstaPy/instapy/unfollow_util.py", line 901, in get_given_user_followers
channel, logger, logfolder)
File "/root/InstaPy/instapy/unfollow_util.py", line 717, in get_users_through_dialog
dialog = browser.find_element_by_xpath(dialog_address)
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()='Followers' or text()='Following']/../../following-sibling::div"}
(Session info: headless chrome=68.0.3440.106)
(Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.4.0-131-generic x86_64)

```
applied this https://github.com/timgrossmann/InstaPy/issues/2757#issuecomment-415963537
then the one you commented right above there

@CharlesCCC
window.history.go(-1) or browser.back() both,
while it returns back it does not pop up the dialog box again.

I will look for a clean solution to it but for now,
I would suggest all users to disable simulation _temporarily_ by adding this line to their quickstart scripts,

session.set_simulation(enabled=False)

Cheers 馃榿

@MuccaDiocan I was having the exact same issue. Disabling simulation fixed that error.

session.set_simulation(enabled=False)

Adding the session.set_simulation(enabled=False) line also fixed it for me. No more StaleElementReferenceException

Alright guys

There is no need to disable simulations.

I have found the total solution for it.

open up unfollow_util.py file and do this modification,

1-)
replace

                browser.get('https://www.instagram.com/' + person)
                userid = browser.execute_script("return window._sharedData.entry_data.ProfilePage[0].graphql.user.id")

with

                dialog_address = "//div[text()='Followers' or text()='Following']/../../following-sibling::div"
                dialog = browser.find_element_by_xpath(dialog_address)
                user_link_in_dialog = dialog.find_element_by_xpath(
                                "//a[contains(@href,'{}')]".format(person))
                click_element(browser, user_link_in_dialog)
                sleep(2)
                userid = browser.execute_script("return window._sharedData.entry_data.ProfilePage[0].graphql.user.id")

2-) before person_list = dialog_username_extractor(buttons) line, add this below

    if channel == "Follow":
        buttons = dialog.find_elements_by_xpath(
            "//button[text()='Follow']")
    elif channel == "Unfollow":
        buttons = dialog.find_elements_by_xpath(
            "//button[text() = 'Following']")

    person_list = dialog_username_extractor(buttons)

I am gonna share a huge set of changes in my new PR soon which will include this change, too.
I have just shared it for you to apply manually.

@CharlesCCC, it was cos the navigation from the dialog box to the user's profile page was done by GET method which was killing the references in return.


Cheers 馃榿

Update:
Error after couple minutes

Traceback (most recent call last):
  File "gay.py", line 45, in <module>
    session.follow_user_followers(['forcecop'], amount=amount_number, randomize=False, interact=True, sleep_delay=300)
  File "/root/InstaPy/instapy/instapy.py", line 2052, in follow_user_followers
    self.logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 916, in get_given_user_followers
    channel, logger, logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 702, in get_users_through_dialog
    quick_username = dialog_username_extractor(quick_button)
  File "/root/InstaPy/instapy/unfollow_util.py", line 752, in dialog_username_extractor
    if person and hasattr(person, 'text') and person.text:
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 68, in text
    return self._execute(Command.GET_ELEMENT_TEXT)['value']
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 461, in _execute
    return self._parent.execute(command, params)
  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.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
  (Session info: headless chrome=68.0.3440.106)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.4.0-131-generic x86_64)

@uluQulu thx a lot!

@uluQulu i installed a fresh install after your recent updates

im still getting error :

.................................................................
INFO [2018-08-26 01:09:47] [user]  Logged in successfully!
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
[0826/010951.271:WARNING:spdy_session.cc(3007)] Received WINDOW_UPDATE for invalid stream 7
[0826/010951.305:WARNING:spdy_session.cc(3007)] Received WINDOW_UPDATE for invalid stream 65
[0826/010951.357:WARNING:spdy_session.cc(3058)] Received HEADERS for invalid stream 65
INFO [2018-08-26 01:09:51] [user]  User 'lebanoneats' [1/4]
INFO [2018-08-26 01:10:10] [user]  Simulated follow : 1
INFO [2018-08-26 01:10:14] [user]  --> Followed b'user.en'
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 671, in get_users_through_dialog
    scroll_bottom(browser, dialog, 2)
  File "C:\Users\testing\Documents\GitHub\InstaPy\instapy\util.py", line 426, in scroll_bottom
    "arguments[0].scrollTop = arguments[0].scrollHeight", element)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 635, in execute_script
    'args': converted_args})['value']
  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: headless chrome=68.0.3440.106)
  (Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64)

@uluQulu For real im lost with all the changes happened can you release a final all in one update for us ?

thanks alot

@HCWcoder
I must be sure that you have applied it correctly.
Can you share your problematic unfollow_util.py file?

As I said earlier I have just opened a huge PR which is including this change and much more.


Cheers 馃榿

@uluQulu
Okey this what i did now after all the mess i did by changing and changing
I did a fresh install chromedriver newest and latest instapy

i still get this :

.................................................................
INFO [2018-08-26 02:50:17] [user]  Logged in successfully!
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
[0826/025020.537:WARNING:spdy_session.cc(3007)] Received WINDOW_UPDATE for invalid stream 67
INFO [2018-08-26 02:50:21] [user]  User 'user' [1/4]
INFO [2018-08-26 02:50:40] [user]  Simulated follow : 1
INFO [2018-08-26 02:50:43] [user]  --> Followed b'auserr'
Traceback (most recent call last):
  File "C:\Users\testing\Documents\GitHub\InstaPy\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 671, in get_users_through_dialog
    scroll_bottom(browser, dialog, 2)
  File "C:\Users\testing\Documents\GitHub\InstaPy\instapy\util.py", line 426, in scroll_bottom
    "arguments[0].scrollTop = arguments[0].scrollHeight", element)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 635, in execute_script
    'args': converted_args})['value']
  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: headless chrome=68.0.3440.106)
  (Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64)

Please Let me know what should i do next sorry for this :(

And I appreciate your help !

@uluQulu Thanks, worked for me! Looking forward to these changes in master.

Welcome @guar47. I have added all of the changes to my live PR.

@HCWcoder
image


Cheers 馃榿

@uluQulu
I told you i just recloned instapy what should i do next what PR's should i do the fix for ?

im a little bit confused.

this is my unfollow util:

unfollow_util.zip

Same here, applied the fix but I still get this error same as HCWcoder


Traceback (most recent call last):
  File "gay.py", line 45, in <module>
    session.follow_user_followers(['forcecop'], amount=amount_number, randomize=False, interact=True, sleep_delay=300)
  File "/root/InstaPy/instapy/instapy.py", line 2052, in follow_user_followers
    self.logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 921, in get_given_user_followers
    channel, logger, logfolder)
  File "/root/InstaPy/instapy/unfollow_util.py", line 671, in get_users_through_dialog
    scroll_bottom(browser, dialog, 2)
  File "/root/InstaPy/instapy/util.py", line 426, in scroll_bottom
    "arguments[0].scrollTop = arguments[0].scrollHeight", element)
  File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 465, in execute_script
    'args': converted_args})['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.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
  (Session info: headless chrome=68.0.3440.106)
  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.4.0-131-generic x86_64)

@MuccaDiocan Seems you use Linux , Debian or Ubuntu ? are you using Cloud ? i dont have any issue ...

@Mehran
No we are using windows 10

I use linux, Ubuntu on digital ocean

Getting the same issue as @MuccaDiocan, also Windows and using interact_user_followers.
It logs in, goes to the user, but before it selects the first account it crashes. Any help will be much appreciated. :)

@MuccaDiocan Same as me but i don't have issue , Ok . Try these Steps and tell me what happen .
1- Create newUbuntu 18 dropblet .
2- install InstaPywith my easy-installation script
curl -s https://gist.githubusercontent.com/Mehran/970a4a6a705f5898ca465312e785f8f4/raw/1d3c46130fb1c6e8af140dd76fd690ab53210335/instapy-easy.sh | sh

Try it .

@alishah same to me

@Mehran, thanks but now I get another error
```
File "gay.py", line 45, in
session.follow_user_followers(['forcecop'], amount=amount_number, randomize=False, interact=True, sleep_delay=300)
File "/root/InstaPy/instapy/instapy.py", line 2052, in follow_user_followers
self.logfolder)
File "/root/InstaPy/instapy/unfollow_util.py", line 921, in get_given_user_followers
channel, logger, logfolder)
File "/root/InstaPy/instapy/unfollow_util.py", line 671, in get_users_through_dialog
scroll_bottom(browser, dialog, 2)
File "/root/InstaPy/instapy/util.py", line 426, in scroll_bottom
"arguments[0].scrollTop = arguments[0].scrollHeight", element)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 465, in execute_script
'args': converted_args})['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.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
(Session info: headless chrome=68.0.3440.106)
(Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.4.0-131-generic x86_64)

```

@uluQulu thank you for looking into this and find the ultimate solution for it. I will be more than happy to CR your PR 馃憤 馃

For others that have similar issue, first please go through the suggested change that @uluQulu mentioned in this thread or please wait for additional PR that will fix this.

It worked until this afternoon, now I have the problems explained in #2780.

Any suggestion or update please?

Hey @cormo1990
The prior temporary solution still is actual- https://github.com/timgrossmann/InstaPy/issues/2745#issuecomment-415968248.
I will look into it soon after finishes a quick work on my own PR 馃槢


Cheers 馃榿

@uluQulu

i followed @CharlesCCC and it worked on this comment

thanks a lot !

@uluQulu It seems I was too fast with saying everything okay. Today I pulled the last updates and got the same error, although I change nothing.

Traceback (most recent call last):
  File "quickstart.py", line 48, in <module>
    sleep_delay=600
  File "/home/ubuntu/InstaPy/instapy/instapy.py", line 2052, in follow_user_followers
    self.logfolder)
  File "/home/ubuntu/InstaPy/instapy/unfollow_util.py", line 924, in get_given_user_followers
    channel, logger, logfolder)
  File "/home/ubuntu/InstaPy/instapy/unfollow_util.py", line 712, in get_users_through_dialog
    quick_username = dialog_username_extractor(quick_button)
  File "/home/ubuntu/InstaPy/instapy/unfollow_util.py", line 760, in dialog_username_extractor
    if person and hasattr(person, 'text') and person.text:
  File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webelement.py", line 68, in text
    return self._execute(Command.GET_ELEMENT_TEXT)['value']
  File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webelement.py", line 461, in _execute
    return self._parent.execute(command, params)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, 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.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.15.0-1020-aws x86_64)

My code is last from GitHub.

@guar47 馃榿馃榿馃榿馃榿
Actually a day after that FIX, another issue popped up and I wrote about it at #2774 and also just _shared_ the solution in there- https://github.com/timgrossmann/InstaPy/issues/2774#issuecomment-416583797
It's fresh new, be fast to get it 馃槑


Cheers 馃榿

@CharlesCCC and @uluQulu

your suggestions is working and fixed the issue but sometimes im getting this :

...................................................................
INFO [2018-08-29 11:05:51] [user]  Logged in successfully!
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
INFO [2018-08-29 11:05:54] [user]  User 'user'[1/4]
INFO [2018-08-29 11:06:10] [user]  Simulated follow : 1
INFO [2018-08-29 11:06:14] [user]  --> Followed b'user5955'
INFO [2018-08-29 11:06:23] [user]  Simulated follow : 2
INFO [2018-08-29 11:06:27] [user]  --> Followed b'user1999'
INFO [2018-08-29 11:06:30] [user]  Simulated follow : 3
Traceback (most recent call last):
  File "user.py", line 44, in job
    session.interact_user_followers(['user'], amount=50, 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 924, in get_given_user_followers
    channel, logger, logfolder)
  File "C:\Users\testing\Documents\GitHub\InstaPy\instapy\unfollow_util.py", line 712, in get_users_through_dialog
    quick_username = dialog_username_extractor(quick_button)
  File "C:\Users\testing\Documents\GitHub\InstaPy\instapy\unfollow_util.py", line 760, 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: headless chrome=68.0.3440.106)
  (Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64)


Please help.

thanks.

Hi @HCWcoder
I added a few more lines to that solution.
Please apply the newly added 5th & 6th steps at the same thread- https://github.com/timgrossmann/InstaPy/issues/2774#issuecomment-416583797


Cheers 馃榿

Hello @uluQulu
thanks for your help.

i followed each step there and the results for now 馃憤

no errors but im getting things like that :


[0830/103200.930:WARNING:spdy_session.cc(3007)] Received WINDOW_UPDATE for invalid stream 69
[0830/103329.095:WARNING:spdy_session.cc(3058)] Received HEADERS for invalid stream 193
[0830/103349.039:WARNING:spdy_session.cc(3058)] Received HEADERS for invalid stream 225

and its only grabbing arround 11 users and i set to interact with 300

INFO [2018-08-30 10:14:36] [user] Grabbed 11 usernames from user'sFollowersto do following.

Please Advise.

thanks.

@HCWcoder
spdy_session.cc is a C++ source file of the chromedriver implementation and those _WARNING_ messages can regularly be seen in console espesically once your chromedriver and Google Chrome browser versions are incompatible.
Also I noticed it happens when you release focus from the web browser that's what happens in your side cos it opens new tabs.
Just dismiss those messages.

It is grabbing only 11 users out of the given amount of 300 means it cannot scroll down == there is a problem.
Provide more details on this to troubleshoot it.


Cheers 馃榿

@CharlesCCC
@uluQulu

.......................................................................
INFO [2018-08-31 01:42:39] [user] Logged in successfully!
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
INFO [2018-08-31 01:42:42] [user] User 'someOneElseFlwers' [1/1]
INFO [2018-08-31 01:42:50] [user] Simulated follow : 1
INFO [2018-08-31 01:42:54] [user] --> Followed b'user'
INFO [2018-08-31 01:42:56] [user] Simulated follow : 2

OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2018-08-31 01:42:56] [user] Session ended - 2018-08-31 01:42:56
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

Traceback (most recent call last):
File "quickstart.py", line 53, in
session.follow_user_followers(['someOneElseFlwers'], amount=10, randomize=True)
File "instapy/instapy.py", line 2052, in follow_user_followers
self.logfolder)
File "instapy/unfollow_util.py", line 924, in get_given_user_followers
channel, logger, logfolder)
File "instapy/unfollow_util.py", line 712, in get_users_through_dialog
quick_username = dialog_username_extractor(quick_button)
File "instapy/unfollow_util.py", line 760, in dialog_username_extractor
if person and hasattr(person, 'text') and person.text:
File "selenium/webdriver/remote/webelement.py", line 68, in text
return self._execute(Command.GET_ELEMENT_TEXT)['value']
File "selenium/webdriver/remote/webelement.py", line 461, in _execute
return self._parent.execute(command, params)
File "selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "selenium/webdriver/remote/errorhandler.py", line 192, 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: headless chrome=68.0.3440.106)
(Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.13.0-41-generic x86_64)

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

ghost picture ghost  路  3Comments

converge picture converge  路  3Comments

46960 picture 46960  路  3Comments

n0sw34r picture n0sw34r  路  3Comments

rahulkapoor90 picture rahulkapoor90  路  3Comments