Skip to content

Instantly share code, notes, and snippets.

@StephenFordham
Created August 8, 2020 15:18
Show Gist options
  • Save StephenFordham/8ed1f8d9dcc13c8399535d65edee7eb7 to your computer and use it in GitHub Desktop.
Save StephenFordham/8ed1f8d9dcc13c8399535d65edee7eb7 to your computer and use it in GitHub Desktop.
iterate_through_headlines
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