import requests
from bs4 import BeautifulSoup
from selenium import webdriver
import time
import re
import os
from selenium.webdriver.common.keys import Keys
import selenium.webdriver.support.ui as ui
driver = webdriver.Chrome('C:\SeleniumDrivers\chromedriver')
def find_hashtags(hashtag):
driver.get('https://twitter.com/hashtag/' + hashtag + '?src=hash')
body=driver.find_element_by_tag_name('body')
wait = ui.WebDriverWait(driver,0.5)
while True:
try:
wait.until(EC.visibility_of_element_located((By.XPATH,"//span[contains(@class, 'Icon Icon--large Icon--logo')]")))
print("error")
break
except:
body.send_keys(Keys.END)
tweets=driver.find_elements_by_class_name('tweet-text')
for tweet in tweets:
print (tweet.text)
find_hashtags("any hashtag")
When i run it on chrome it scrolls sccessfully but it cant print tweets content so there arent any problems in webdriver.