Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Updated example screenshot of the toolbar with the new design.
  • Loading branch information
tim-schilling committed Aug 14, 2026
commit 1b4e1de5f7028c3b9fc4241be2860f6428ef2f2f
3 changes: 3 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Pending
an ``aria-live`` status for history refreshes, and WCAG 2.1 AA contrast in
both themes.
* Added a talk to the resources documentation.
* Updated the example screenshot.
* Updated the screenshot capture logic to find the toolbar elements in the
shadow DOM.

7.1.1 (2026-08-14)
------------------
Expand Down
Binary file modified example/django-debug-toolbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 20 additions & 4 deletions example/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import subprocess
from time import sleep

from selenium.common import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
Expand All @@ -17,7 +18,7 @@ def parse_args():
parser.add_argument("--headless", action="store_true")
parser.add_argument("--outfile", "-o", required=True)
parser.add_argument("--width", type=int, default=900)
parser.add_argument("--height", type=int, default=700)
parser.add_argument("--height", type=int, default=1200)
return parser.parse_args()


Expand Down Expand Up @@ -61,6 +62,21 @@ def submit_form(selenium, data):
WebDriverWait(selenium, timeout=5).until(EC.url_changes(url))


def find_including_toolbar(selenium, by, value):
"""Find the toolbar elements within the shadow root DOM"""
selectors = {
By.ID: "#{}",
By.CLASS_NAME: ".{}",
By.TAG_NAME: "{}",
By.CSS_SELECTOR: "{}",
}
try:
return selenium.find_element(by, value)
except NoSuchElementException:
shadow_root = selenium.find_element(By.ID, "djDebugRoot").shadow_root
return shadow_root.find_element(By.CSS_SELECTOR, selectors[by].format(value))


def main():
args = parse_args()
with example_server() as p:
Expand All @@ -73,12 +89,12 @@ def main():

selenium.get("http://localhost:8000/admin/auth/user/")
# Check if SQL Panel is already visible:
sql_panel = selenium.find_element(By.ID, "djdt-SQLPanel")
sql_panel = find_including_toolbar(selenium, By.ID, "djdt-SQLPanel")
if not sql_panel:
# Open the admin sidebar.
el = selenium.find_element(By.ID, "djDebugToolbarHandle")
el = find_including_toolbar(selenium, By.ID, "djDebugToolbarHandle")
el.click()
sql_panel = selenium.find_element(By.ID, "djdt-SQLPanel")
sql_panel = find_including_toolbar(selenium, By.ID, "djdt-SQLPanel")
# Open the SQL panel.
sql_panel.click()

Expand Down
Loading