Repository: InstaPy/InstaPy

Issue:
session.follow_user_following(...) erroring: '''Message: invalid argument: 'value' must be a string'''
## Problem Code:
```session.follow_user_following(['sasha_rude', 'sashapcb', 'space_trashy', 'elon'], amount=10, randomize=True, sleep_delay=1)```

## Error:
> Traceback (most recent call last):
>   File "instagram.py", line 39, in <module>
>     session.follow_user_following(['sasha_rude', 'sashapcb', 'space_trashy', 'elon'], amount=10, randomize=True, sleep_delay=1)
>   File "/home/holden/.local/lib/python2.7/site-packages/instapy/instapy.py", line 3360, in follow_user_following
>     self.logfolder)
>   File "/home/holden/.local/lib/python2.7/site-packages/instapy/unfollow_util.py", line 1108, in get_given_user_following
    browser.find_element_by_xpath(read_xpath(get_given_user_following.__name__,"all_following")).text)
  File "/home/holden/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath
    return self.find_element(by=By.XPATH, value=xpath)
  File "/home/holden/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
    'value': value})['value']
  File "/home/holden/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/holden/.local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 243, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: 'value' must be a string
  (Session info: chrome=75.0.3770.80)
  (Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 4.15.0-43-generic x86_64)

## Fix (~/.local/lib/python2.7/site-packages/instapy/unfollow_util.py):

>        ###### OLD ####
>        #allfollowing = format_number(
>        #    browser.find_element_by_xpath(
>        #        read_xpath(
>        #            get_given_user_following.__name__,"all_following")
>        #        )
>        #    .text
>        #)
>        #### END OLD ####

```
        ## NEW ##
        allfollowing = format_number(
            browser.find_element_by_xpath(
                str(
                    read_xpath(
                        get_given_user_following.__name__,"all_following")
                    )
                )
            )
        ## END NEW ##
```

## Your Welcome! <3

[instagram_issue.py.txt](https://github.com/timgrossmann/InstaPy/files/3259261/instagram_issue.py.txt)



Discussion:
I'll fork an implementation and request to merge. 
Thanks mate!
I changed it to # 4520, it lasted longer but the same error occurred in 6 hours later
Same error found when following by a given list of users. 

Resolving patch:
diff --git a/instapy/__init__.py b/instapy/__init__.py
--- a/instapy/__init__.py
+++ b/instapy/__init__.py
@@ -8,5 +8,5 @@
 
 
 # __variables__ with double-quoted values will be available in setup.py
-__version__ = "0.5.1"
+__version__ = "0.5.2"
 
diff --git a/instapy/util.py b/instapy/util.py
--- a/instapy/util.py
+++ b/instapy/util.py
@@ -942,7 +942,7 @@ def get_relationship_counts(browser, username, logger):
     except WebDriverException:
         try:
             followers_count = format_number(
-                browser.find_element_by_xpath(read_xpath(get_relationship_counts.__name__,"followers_count")).text)
+                browser.find_element_by_xpath(str(read_xpath(get_relationship_counts.__name__,"followers_count"))))
         except NoSuchElementException:
             try:
                 browser.execute_script("location.reload()")
@@ -983,7 +983,7 @@ def get_relationship_counts(browser, username, logger):
     except WebDriverException:
         try:
             following_count = format_number(
-                browser.find_element_by_xpath(read_xpath(get_relationship_counts.__name__,"following_count")).text)
+                browser.find_element_by_xpath(str(read_xpath(get_relationship_counts.__name__,"following_count"))))
 
         except NoSuchElementException:
             try:


Test patch: