Guest User

Untitled

a guest
Aug 6th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. users = ['BBCWorld']
  2.  
  3. username = browser.find_element_by_class_name("js-username-field")
  4. username.send_keys("username")
  5. password = browser.find_element_by_class_name("js-password-field")
  6. password.send_keys("password")
  7.  
  8. signin_click = WebDriverWait(browser, 500000).until(
  9. EC.element_to_be_clickable((By.XPATH, '//*[@id="page-container"]/div/div[1]/form/div[2]/button'))
  10. )
  11. signin_click.click()
  12.  
  13. for user in users:
  14. # User's profile
  15. browser.get('https://twitter.com/' + user)
  16.  
  17. time.sleep(0.5)
  18.  
  19. SCROLL_PAUSE_TIME = 0.5
  20.  
  21. # Get scroll height
  22. last_height = browser.execute_script("return document.body.scrollHeight")
  23.  
  24. while True:
  25. # Scroll down to bottom
  26. browser.execute_script("window.scrollTo(0, document.body.scrollHeight)")
  27.  
  28. # Wait to load page
  29. time.sleep(SCROLL_PAUSE_TIME)
  30.  
  31.  
  32. # Calculate new scroll height and compare with last scroll height
  33. new_height = browser.execute_script("return document.body.scrollHeight")
  34.  
  35.  
  36.  
  37. # Quit browser
  38. browser.quit()
Add Comment
Please, Sign In to add comment