Examples
Wait before taking screenshot with Python and Selenium
Install Selenium for Python
pip install selenium selenium 4.11+ includes Selenium Manager, which downloads the right chromedriver automatically — no separate driver install needed.
Take a screenshot and save to file
Wait for the page to settle before taking the screenshot.
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
options = Options()
options.add_argument('--headless=new')
driver = webdriver.Chrome(options=options)
driver.get('https://www.htmltoimage.com/demo')
# Wait for late content — here an element that appears after 2 seconds.
WebDriverWait(driver, 5).until(
EC.visibility_of_element_located((By.CSS_SELECTOR, '#delayed-banner'))
)
driver.save_screenshot('wait.png')
driver.quit() Find out how to take a full-page screenshot with Python and Selenium.
That was 19 lines of code — plus a browser to run in production
Keeping headless browsers fed, patched and scaled is a job in itself. We built Urlbox so the same screenshot is one API call:
curl "https://api.urlbox.com/v1/YOUR_API_KEY/png?url=https://example.com" Try the Urlbox screenshot API — free trial, no browser babysitting.