Skip to content

Commit b26b159

Browse files
authored
Debug
1 parent 9359d97 commit b26b159

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

scripts/automated-notebook-run-script.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,21 +190,29 @@ def main():
190190
""",
191191
download_button,
192192
)
193-
applescript = '''
193+
applescript = """
194194
tell application "System Events"
195195
tell process "Safari"
196-
set buttonNames to {}
197-
-- Get all buttons in the first window
196+
set buttonInfo to {}
198197
repeat with aButton in (every button of window 1)
199-
set end of buttonNames to name of aButton
198+
set theName to name of aButton
199+
if theName is missing value then
200+
set theName to description of aButton
201+
end if
202+
if theName is missing value then
203+
set theName to role description of aButton
204+
end if
205+
if theName is missing value then
206+
set theName to "«no name»"
207+
end if
208+
set end of buttonInfo to theName
200209
end repeat
201-
-- Return the list of button names
202-
return buttonNames
210+
return buttonInfo
203211
end tell
204212
end tell
205-
'''
213+
"""
206214

207-
result = subprocess.run(['osascript', '-e', applescript], capture_output=True, text=True)
215+
result = subprocess.run(["osascript", "-e", applescript], capture_output=True, text=True)
208216
print(result.stdout)
209217
time.sleep(2)
210218

0 commit comments

Comments
 (0)