Skip to content

Instantly share code, notes, and snippets.

@kmandana
Created April 18, 2020 18:50
Show Gist options
  • Select an option

  • Save kmandana/b6733889a999eace12e091acb54f3188 to your computer and use it in GitHub Desktop.

Select an option

Save kmandana/b6733889a999eace12e091acb54f3188 to your computer and use it in GitHub Desktop.
Click likes Button
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