Skip to content

Commit

Permalink
Probably fixed "Cannot find Follow button" #128
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Mishchenko committed Oct 8, 2020
1 parent 553342b commit c2fdfb9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/action_handle_blogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit c2fdfb9

Please sign in to comment.