I am trying to change the default browser between Chrome and Safari without needing user input except for initially running it.
I found this utility that takes care of the difficult bit:
It can be installed using Homebrew by running:
However when you run it a dialogue box shows up asking if I want to change browser. I want to press the "Yes "button using AppleScript. Below is a screenshot.
I want to find the application that contains this window. Is there a better way to find out where the window is rather than go through them all?
I've tried foremost window but it seems to return the foremost program. Here's some program I've tried:
tell application "System Events" tell process "SecurityAgent" click button 1 of window 1 end tell delay 0.2 end tell