Hacker News new | ask | show | jobs
by mcintyre1994 3026 days ago
Definitely just speculating here, but there is a `driver.save_screenshot(path)` method that would probably be worth trying.

This worked for me:

    from selenium.webdriver import Firefox
    from selenium.webdriver.firefox.options import Options

    geckodriver_path = '/usr/local/bin/geckodriver'
    options = Options()
    options.add_argument('-headless')
    driver = Firefox(executable_path=geckodriver_path, firefox_options=options)

    url='https://news.ycombinator.com/item?id=16576015'
    driver.get(url)
    driver.save_screenshot('./hn.png')