Skip to content

IndexError: list index out of range #13

@giorgossavva

Description

@giorgossavva

The code
next = True
while(next):
n_li_1 = len(self.driver.find_elements_by_class_name("FPmhX"))
self.driver.execute_script(next_scroll)
time.sleep(1.5)
n_li_2 = len(self.driver.find_elements_by_class_name("FPmhX"))
if(n_li_1 != n_li_2):
following = self.driver.find_elements_by_xpath("//*[contains(text(), 'Following')]")
for follow in following:
el = follow.find_element_by_xpath('../..')
el = el.find_element_by_tag_name('a')
profile = el.get_attribute('href')
my_followers_set.add(profile)
else:
next = False

        return list(my_followers_set)

The error
Traceback (most recent call last):
File "get_my_followers.py", line 34, in
get_my_followers(config)
File "get_my_followers.py", line 20, in get_my_followers
my_followers = b.get_my_followers(username)
File "C:\Users\user\PycharmProjects\testing\bot.py", line 71, in get_my_followers
followers[1].click()
IndexError: list index out of range

no idea what to do

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions