Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created March 3, 2021 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/b6620c163cc62a1555c2275bcc834936 to your computer and use it in GitHub Desktop.
Save amankharwal/b6620c163cc62a1555c2275bcc834936 to your computer and use it in GitHub Desktop.
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('http://stackoverflow.com/questions?sort=votes')
title = browser.find_element_by_css_selector('h1').text
questions = browser.find_elements_by_css_selector('.question-summary')
for question in questions:
question_title = question.find_element_by_css_selector('.summary h3 a').text
question_excerpt = question.find_element_by_css_selector('.summary .excerpt').text
question_vote = question.find_element_by_css_selector('.stats .vote .votes .vote-countpost').text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment