Created
August 8, 2020 15:18
-
-
Save StephenFordham/8ed1f8d9dcc13c8399535d65edee7eb7 to your computer and use it in GitHub Desktop.
iterate_through_headlines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
top_titles = driver.find_elements_by_css_selector('div[class="css-14rwwjy-Promo ett16tt11"]') | |
with open('Coronavirus_headlines.txt', 'w') as cor_virus: | |
for title in top_titles: | |
headline = title.find_element_by_css_selector('p[class="css-1aofmbn-PromoHeadline ett16tt4"]').text | |
cor_virus.write('\n') | |
cor_virus.write(headline) | |
print(headline) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment