Skip to content

Instantly share code, notes, and snippets.

@dev4Fun
Created September 10, 2020 03:27
Show Gist options
  • Save dev4Fun/385c3808a65ada7bfa516854cc2fac42 to your computer and use it in GitHub Desktop.
Save dev4Fun/385c3808a65ada7bfa516854cc2fac42 to your computer and use it in GitHub Desktop.
def like_post(self, post):
self.open_and_switch_to_tab(post.post_link)
try:
self.wait_until(ec.presence_of_element_located((By.CLASS_NAME, 'fr66n')))
self.driver.find_element_by_class_name('fr66n').click()
post_tracker.liked_post(post)
logger.info(f"Liked {post}")
rand_wait_sec()
return True
# post might get removed
except (NoSuchElementException, TimeoutException):
return False
finally:
self.close_and_open_tab()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment