playwright-visibility-debug is a small standalone debugging utility for Playwright-based UI investigations. It is built around one question:
Is this element actually visible and usable in the browser viewport, and if not, what is blocking it?
It goes beyond locator.isVisible() and reports on:
- DOM presence and match count
- multi-match selector handling
- viewport intersection
- computed styles such as
display,visibility,opacity, andpointer-events - clipping by overflow ancestors
- overlap/occlusion sampled via
document.elementFromPoint() - before/after screenshots and a JSON report
- Bun-first CLI workflow: the source CLI is designed to run comfortably with Bun and Crust.
- Node-friendly build/test flow: the project also ships a normal TypeScript build and Vitest setup, and the emitted
dist/cli.jsis meant to stay runnable with Node where possible.
curl -fsSL https://gist.githubusercontent.com/tobiashochguertel/bf7bc60f8946c7ecbe0d14782b4a8c99/raw/install.sh | bashBy default this installs into:
- repo clone:
~/.taskfiles/taskscripts/playwright-visibility-debug - command shims:
~/.local/bin/playwright-visibility-debugand~/.local/bin/pw-visibility-debug - deployed Taskfile:
~/.taskfiles/taskscripts/Taskfile.playwright-visibility-debug.yml - orchestrator include:
~/.taskfiles/Taskfile.taskscripts.yml
mkdir -p ~/gists
git clone https://gist.github.com/bf7bc60f8946c7ecbe0d14782b4a8c99.git ~/gists/playwright-visibility-debug-gist
cd ~/gists/playwright-visibility-debug-gist
git remote set-url origin git@gist.github.com:bf7bc60f8946c7ecbe0d14782b4a8c99.git
bun installplaywright-visibility-debug inspect \
--url http://localhost:53940/?q=documentation \
--selector '[aria-label="Theme mode"]' \
--device-preset iphone-11-custom \
--click '[aria-label="Open filters"]' \
--wait 250Useful flags:
--urlrequired target URL--selectorrequired selector to inspect--labeloptional report label--clickrepeatable action selector--waitwait in milliseconds after navigation/actions--device-presetbuilt-in preset name--browser chromium|firefox|webkit--no-headlessrun headed--no-full-pagedisable full-page screenshots--jsonprint the raw report to stdout
playwright-visibility-debug presets list
playwright-visibility-debug presets show iphone-11-customplaywright-visibility-debug doctoriphone-11-custom
- viewport:
414x896 - DPR:
2 - mobile Safari-style user agent
- mobile/touch context enabled
This matches the custom iPhone 11 emulation profile used during diagnosis of the mobile theme-control issue in the parent project.
GitHub Gists do not support nested directories, so the TypeScript source and Vitest files live at the gist root:
cli.tsdiagnostics.tsformat.tsindex.tslogger.tspresets.tsschemas.tstypes.tsversion.tsformat.test.tspresets.test.ts
bun install
bun run typecheck
bun run build
bun run test
bun run cli.ts doctor
node dist/cli.js doctorThis gist ships Taskfile.playwright-visibility-debug.yml. If you keep personal task includes, add something like this to your shared Taskfile registry:
includes:
playwright-visibility-debug:
taskfile: ~/.taskfiles/taskscripts/playwright-visibility-debug/Taskfile.playwright-visibility-debug.yml
optional: trueThe inspect command writes:
before-actions.pngafter-actions.png<label-or-selector>.json
Default output directory:
./playwright-visibility-debug-output