Created
April 18, 2020 18:50
-
-
Save kmandana/b6733889a999eace12e091acb54f3188 to your computer and use it in GitHub Desktop.
Click likes Button
This file contains hidden or 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 scrapeUsernames(self): | |
| self.browser.get(self.url) | |
| try: | |
| likes = WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.CSS_SELECTOR, '#react-root > section > main > div > div.ltEKP > article > div.eo2As > section.EDfFK.ygqzn > div > div.Nm9Fw > button'))) | |
| no_of_likes = likes.text.replace('others', '').replace('likes', '').replace(',', '').strip() | |
| except: | |
| likes = WebDriverWait(self.browser, 5).until(EC.presence_of_element_located((By.CSS_SELECTOR, '#react-root > section > main > div > div.ltEKP > article > div.eo2As > section.EDfFK.ygqzn > div > div > button'))) | |
| no_of_likes = likes.text.replace('others', '').replace('likes', '').replace(',', '').strip() | |
| likes.click() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment