Here's a solution that I used to figure out how Chrome renders it context menu to configure it for use with picom or compton. This was hard because technically the menu is rendered by Chrome window and while the menu is open, the mouse is grabbed so I cannot use xprop directly.
In practice, I used xwininfo to get list of all X windows (including the ones that have no user visible or accessible parts) and then run xprop -id against every one of those.
Here's the bash one-liner which creates files called res1, res2, ..., res9 in the current working directory if you let in run for about 10–20 seconds:
for ((i=1; i<=9; i++)); do echo -n "res$i ..."; xwininfo -root -tree | sort -u | grep -oP '^\s*0x[0-9a-f]+\b' | xargs -rn1 xprop -id > res$i; echo " done"; sleep 2; done
It shows res1... while the snapshotting of the first state is in process (running xprop repeatedly for every single window takes some time) and then done is appended after the snapshot is complete. Then you have 2 seconds to change the state of the system (e.g. switch to another window, click a menu open, open a new app) and then another snapshot of the system state is taken. Try to make any changes between seeing "done" and the "res..." on next line.
Keep in mind when you did the change to the system you're interested in. For example, when I executed above, I let it collect current state while I'm still in terminal. When I saw done, I switched to Chrome window and waited until seeing another done (which was the line res2 in my case). Then I opened the menu I was interested in and waited with the open menu until seeing res3... done to know that I have full snapshot for that state. I then switched back to the terminal and pressed Ctrl+C to stop the data collecting (it would automatically stop after collecting 9 states).
Now I knew that the change I was interested in was between states res2 and res3 so I could run meld res2 res3 & to view the changes in graphical comparision UI.
Update: here's an even longer one-liner for those pesky windows that xprop shows nothing for. This one collects both xprop and xwininfo for all windows but it's pretty slow to run. It similarly creates files called res1, res2, ..., res9 in current working directory:
for ((i=1; i<=9; i++)); do echo -n "res$i ..."; echo > "res$i"; xwininfo -root -tree | sort -u | grep -oP '^\s*0x[0-9a-f]+\b' | while read id; do echo -n "."; printf "\n\nWindow id %s:\n\n" "$id" >> "res$i"; xprop -id "$id" >> "res$i"; xwininfo -id "$id" >> "res$i"; done; echo " done"; sleep 2; done
For an example, here's the command line I use to run picom without any config files:
picom --config /dev/null --log-file /dev/null --shadow -o 0.50 -r 8 -l -8 -t -8 --corner-radius 4 --backend glx --glx-no-stencil --glx-no-rebind-pixmap --no-use-damage --xrender-sync-fence --vsync --shadow-exclude '_GTK_FRAME_EXTENTS@:c' --shadow-exclude "name ?= 'Thunderbird' && (window_type = 'utility' || window_type = 'popup_menu')" --rounded-corners-exclude "_NET_WM_WINDOW_TYPE:a = '_NET_WM_WINDOW_TYPE_DND'" --shadow-exclude "_NET_WM_STATE:a = '_NET_WM_STATE_ABOVE' && _NET_WM_WINDOW_TYPE:a = '_NET_WM_WINDOW_TYPE_MENU'" --shadow-exclude "WM_CLASS:s = 'xfwm4-wireframe'" --shadow-exclude '! class_g && ! class_i && ! _NET_WM_WINDOW_TYPE:a' --no-fading-openclose --unredir-if-possible --unredir-if-possible-delay 50 > /dev/null 2>&1 &