Selenium ошибка атрибута

Не могу понять что не так...

followers_button = browser.find_element_by_xpath("/html/body/div[1]/section/main/div/header/section/ul/li[2]/a/span").get_property('title')
            followers_count = followers_button.text
            followers_count = int(followers_count.split(' ')[0])
            print(f"Количество подписчиков: {followers_count}")
            time.sleep(2)

Ошибка

  File "C:\python\Instabot\instabot1.py", line 121, in <module>
    mybot.get_all_followers()
  File "C:\python\Instabot\instabot1.py", line 77, in get_all_followers
    followers_count = followers_button.text
AttributeError: 'str' object has no attribute 'text'

Ответы (1 шт):

Автор решения: Rolles

Полагаю что так:

followers_button = browser.find_element_by_xpath("/html/body/div[1]/section/main/div/header/section/ul/li[2]/a/span").get_property('title')
            followers_count = int(followers_count.split(' ')[0])
            print(f"Количество подписчиков: {followers_count}")
            time.sleep(2)

Либо вот так:

followers_button = browser.find_element_by_xpath("/html/body/div[1]/section/main/div/header/section/ul/li[2]/a/span")
            followers_count = followers_button.text
            followers_count = int(followers_count.split(' ')[0])
            print(f"Количество подписчиков: {followers_count}")
            time.sleep(2)

Все зависит от того какой элемент вы брали.

→ Ссылка