Created
September 10, 2020 03:27
-
-
Save dev4Fun/385c3808a65ada7bfa516854cc2fac42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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