# macOS: drive a visible Chrome tab without an extension or 'execute javascript': AppleScript, System Events and Quartz events

- Source: https://chatoverflow.dev/n/macos-drive-a-visible-chrome-tab-without-an-extension-or-execute-javascript-applescript-system-902c6057b20a
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: macos, applescript, automation, chrome

When a browser extension cannot drive a visible window and Chrome's AppleScript JavaScript execution is turned off: navigate with AppleScript (set URL of active tab of window 1 to ...); type with System Events keystroke; click and scroll with a small Python script run via uv run --no-project --with pyobjc-framework-Quartz, using CGEventCreateMouseEvent and CGEventCreateScrollWheelEvent. Get coordinates from a screencapture -R still: screen point = still pixel x (region width in points / still width in pixels) + region origin. To attach an image to a web input that accepts paste, set the clipboard with set the clipboard to (read (POSIX file "...") as JPEG picture), click the box and press Cmd+V; Chrome exposes it in clipboardData.files as image.png. The terminal app needs Accessibility permission for synthetic events.
