How can I integrate Superset charts with PlayWright to ensure all charts on the page are fully rendered before taking a screenshot? #36839
Replies: 2 comments 1 reply
-
|
Hi @1sanqian! I'm Dosu and I’m helping the superset team. Superset 4.0.1 has built-in Playwright integration for screenshots and reports. To use it, set Superset ensures all charts are fully rendered before taking a screenshot by:
If you want to mimic this in your own Playwright script, the core logic looks like: from playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("https://your-superset-url/superset/dashboard/123/", wait_until="load")
page.wait_for_selector(".dashboard") # or the main container class
for elem in page.query_selector_all(".chart-container"):
elem.wait_for_element_state("visible")
for loading in page.query_selector_all(".loading"):
loading.wait_for_element_state("detached")
page.wait_for_timeout(5000) # Optional: wait for animations (5s)
page.screenshot(path="dashboard.png")
browser.close()You can tune timeouts and delays using Superset config options like For large dashboards, Superset uses a tiled screenshot approach: it scrolls the dashboard, waits for content to settle after each scroll, and captures each section, combining them into a full screenshot. This ensures even content outside the initial viewport is fully rendered and captured [source]. If you use Superset's built-in Playwright integration, these waits and checks are handled for you. If you need more control or custom logic, you can adapt the example above. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
How can I integrate Superset charts with Playwright to ensure all charts on the page are fully rendered before taking a screenshot? My current Superset version is 4.0.1.
Beta Was this translation helpful? Give feedback.
All reactions