Advertisement
Guest User

Untitled

a guest
Sep 4th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. import os
  2. from selenium import webdriver
  3. from selenium.webdriver.common.keys import Keys
  4. from bs4 import BeautifulSoup
  5. import time
  6.  
  7. # get the path of ChromeDriverServer
  8. dir = os.path.dirname(__file__)
  9. chrome_driver_path = dir + "chromedriver.exe"
  10.  
  11. # create a new Chrome session
  12. driver = webdriver.Chrome(chrome_driver_path)
  13. driver.implicitly_wait(30)
  14. driver.maximize_window()
  15.  
  16. # navigate to the application home page
  17. driver.get("http:/facebook.com")
  18.  
  19. # get the search textbox
  20. search_fielduser = driver.find_element_by_name("email")
  21. search_fieldpass = driver.find_element_by_name("pass")
  22. # enter search keyword and submit
  23. search_fielduser.send_keys("username")
  24. search_fieldpass.send_keys("password")
  25. search_fielduser.submit()
  26. driver.implicitly_wait(30)
  27.  
  28. #add profile id with visible friends
  29. driver.get("https://www.facebook.com/search/#profilenumber/friends")
  30. SCROLL_PAUSE_TIME = 0.5
  31.  
  32.  
  33. html = driver.page_source
  34.  
  35. soup = BeautifulSoup(html, "html.parser")
  36.  
  37. links = soup.find_all('_3u1 _gli _uvb')
  38. print(links)
  39.  
  40. print ("klaar")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement