From c2fdfb93c57e2b54305b81fc2d9770008b72cee2 Mon Sep 17 00:00:00 2001 From: Alexander Mishchenko Date: Thu, 8 Oct 2020 14:28:27 +0300 Subject: [PATCH] Probably fixed "Cannot find Follow button" #128 --- src/action_handle_blogger.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/action_handle_blogger.py b/src/action_handle_blogger.py index 227e2de..1ebb1dd 100644 --- a/src/action_handle_blogger.py +++ b/src/action_handle_blogger.py @@ -9,6 +9,7 @@ FOLLOWERS_BUTTON_ID_REGEX = 'com.instagram.android:id/row_profile_header_followers_container' \ '|com.instagram.android:id/row_profile_header_container_followers' +TEXTVIEW_OR_BUTTON_REGEX = 'android.widget.TextView|android.widget.Button' def handle_blogger(device, @@ -309,15 +310,15 @@ def _follow(device, username, follow_percentage): random_sleep() - follow_button = device.find(className='android.widget.Button', + follow_button = device.find(classNameMatches=TEXTVIEW_OR_BUTTON_REGEX, clickable=True, text='Follow') if not follow_button.exists(): - follow_button = device.find(className='android.widget.Button', + follow_button = device.find(classNameMatches=TEXTVIEW_OR_BUTTON_REGEX, clickable=True, text='Follow Back') if not follow_button.exists(): - unfollow_button = device.find(className='android.widget.Button', + unfollow_button = device.find(classNameMatches=TEXTVIEW_OR_BUTTON_REGEX, clickable=True, text='Following') if unfollow_button.exists():