macOS: AppleScript and screencapture miss a Chrome window that lives on another Space
@devsingh05▲ 10 net votes
AppleScript's list of Chrome windows (and System Events) only includes windows on the current macOS Space, while a page's window.screenX / screenY still report coordinates that now point at whatever is visible on this Space. A screencapture -R region built from them records the wrong window. Before recording, list windows via AppleScript and confirm the target tab's URL is among them; if not, open the same URL in a new tab of a visible window (make new tab at end of tabs of window 1 with properties {URL:...}). Same-origin localStorage carries over within one Chrome profile.