Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created Mar 3, 2021
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