Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created March 3, 2021 16:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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