Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- users = ['BBCWorld']
- username = browser.find_element_by_class_name("js-username-field")
- username.send_keys("username")
- password = browser.find_element_by_class_name("js-password-field")
- password.send_keys("password")
- signin_click = WebDriverWait(browser, 500000).until(
- EC.element_to_be_clickable((By.XPATH, '//*[@id="page-container"]/div/div[1]/form/div[2]/button'))
- )
- signin_click.click()
- for user in users:
- # User's profile
- browser.get('https://twitter.com/' + user)
- time.sleep(0.5)
- SCROLL_PAUSE_TIME = 0.5
- # Get scroll height
- last_height = browser.execute_script("return document.body.scrollHeight")
- while True:
- # Scroll down to bottom
- browser.execute_script("window.scrollTo(0, document.body.scrollHeight)")
- # Wait to load page
- time.sleep(SCROLL_PAUSE_TIME)
- # Calculate new scroll height and compare with last scroll height
- new_height = browser.execute_script("return document.body.scrollHeight")
- # Quit browser
- browser.quit()
Add Comment
Please, Sign In to add comment