Getting Safari Title in Variable

Hi all,

Mac Monterey with latest Safari v17.0 (I have allowed javascript in safari dev area for both smart search field and apple events)

I am trying to do a very basic thing but getting errors:

I simply want to get the document title of the current active Safari page, but I keep getting errors:

This is the basic macro...

Will execute the following actions:
Activate Safari
Notify on failure.
Set Variable “safari_title” to Safari Field “%SafariTitle%”
Notify on failure.
Display Text Briefly
safari_title is %Variable%safari_title%


2023-10-07 10:27:33 Execute macro “get web page title sarafi” from trigger Editor
2023-10-07 10:27:33 Action 14702966 failed: Set Variable to Safari Field failed to get value of field %SafariTitle%
2023-10-07 10:27:33 Set Variable to Safari Field failed to get value of field %SafariTitle% in macro “get web page title sarafi” (while executing Set Variable “safari_title” to Safari Field “%SafariTitle%”).

You should always post your actual macro, as it makes debugging a lot easier for other forum users.

If Safari is running and has a window, it need not be the frontmost application. This will display the current Safari Title:

If that isn't what you're after, perhaps give a bit more context as to your broader goal with this macro.


Sure - Ok of course I will remove sensitive info first..

Q: can you remind me the best way to export a macro then post it on the forum?

1 Like

Thanks Much noisneil - I will post soon

1 Like

Ok I think I was able to post the macro thanks to your help..

I think maybe it could be this: trouble with SafariTitleTest - trouble with set variable to Safari field... maybe this is only for form fields on a Safari page - and not to get Page Title?