Skip to content

Instantly share code, notes, and snippets.

@mottet-dev
Created September 11, 2018 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mottet-dev/41744a4ae202598c3a3bd92484f385b5 to your computer and use it in GitHub Desktop.
Save mottet-dev/41744a4ae202598c3a3bd92484f385b5 to your computer and use it in GitHub Desktop.
def unfollowWithUsername(self, username):
self.browser.get('https://www.instagram.com/' + username + '/')
time.sleep(2)
followButton = self.browser.find_element_by_css_selector('button')
if (followButton.text == 'Following'):
followButton.click()
time.sleep(2)
confirmButton = self.browser.find_element_by_xpath('//button[text() = "Unfollow"]')
confirmButton.click()
else:
print("You are not following this user")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment