Hi, I am trying to use an AppleScript to press a button on a popup window from a website as shown
I have identified how to get to the buttons as shown:
I want to press the third Download button and my code is essentially
tell application "System Events" to tell application process "Safari"
tell window 1 to tell splitter group 1 to tell tab group 1 to tell group 1 to tell group 1 to tell scroll area 1 to tell UI element 1
tell group 40 to tell UI element 7
try
perform action "AXPress" of button "Download"
on error errMsg
my logIt("Energy.scpt: Trying to press download button: " & errMsg, 2)
end try
end tell
end tell
end tell # System Events
However, this does not work and I was concerned that the actual button does not have a name of ‘UI element 7’ but this is what is displayed when you ask for the ‘by Index’ view of the UI elements. I can’t use the name ‘Download’ as there are four of these in the popup so I have no idea which one would be pressed.
Has anyone got any advice as to how I can resolve this issue?