Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import selenium
  2. from selenium.common.exceptions import NoSuchElementException
  3. import time
  4. import json
  5. import re
  6. from selenium import webdriver
  7. import bs4
  8. from urllib.request import urlopen as uReq
  9. from bs4 import BeautifulSoup as soup
  10. import json
  11.  
  12. url = "https://www.instagram.com/p/Bz0cp0dgA4L/"
  13. driver = webdriver.Chrome('/Users/wjtho/Downloads/chromedriver')
  14. driver.get(url)
  15.  
  16. #Banner: Not Logged IN: Button to get rid of the did not login button
  17. driver.implicitly_wait(40)
  18. driver.find_element_by_class_name('dCJp8.afkep.xqRnw._0mzm-').click()
  19.  
  20. %%time
  21. err = 0
  22. i = 1
  23.  
  24. while (err == 0):
  25. try:
  26. button = driver.find_element_by_class_name('Igw0E.IwRSH.YBx95._4EzTm.MGdpg.NUiEW')
  27. button.click()
  28. print(i)
  29. i += 1
  30. except NoSuchElementException:
  31. err += 1
  32. i += 1
  33.  
  34. err
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement