Skip to content

Instantly share code, notes, and snippets.

@kuzminT
Last active January 3, 2021 18:13
Show Gist options
  • Save kuzminT/c3cf3f93f994a7feda35c7e441c5ff53 to your computer and use it in GitHub Desktop.
Save kuzminT/c3cf3f93f994a7feda35c7e441c5ff53 to your computer and use it in GitHub Desktop.
Scrappers, parsers, crawlers. Scrapping websites with python. Tips and usefool links
# Headless Firefox
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
opts = Options()
opts.headless = True
assert opts.headless # No gui
browser = Firefox(options=opts)
browser.get('https://google.com/search?q=test')
print(browser.title)
links = browser.find_elements_by_css_selector('.r a')
print(links[0].text)
browser.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment