You must Hide the toolbar before setting full screen mode.
When full screen mode is active, the GUI scripting is unable to trigger an item of the menu bar because this structure is not displayed.
--delay 10
tell application "Safari"
activate
close every window
end tell
delay 2
tell application "System Events"
tell process "Safari"
set frontmost to true
try
--click menu item "Hide Toolbar" of menu 1 of menu bar item "View" of menu bar 1
click menu item 1 of menu 1 of menu bar item 5 of menu bar 1
end try
end tell
end tell
delay 2
tell application "System Events"
tell process "Safari"
set frontmost to true
try
--click menu item "Enter Full Screen" of menu 1 of menu bar item "View" of menu bar 1
keystroke "f" using {command down, control down}
end try
end tell
end tell
(*
-- delay 3
tell application "System Events"
tell process "Safari"
set frontmost to true
class of every UI element of window 1
log result --> (*group, group*)
position of group 2 of window 1
log result --> (*0, 0*)
class of UI elements of group 2 of window 1
log result --> (*tab, group*)
-- properties of first tab of group 2 of window 1 # doesn't compile
properties of first UI element of group 2 of window 1
log result --> (*class:tab, minimum value:missing value, orientation:missing value, position:0, 22, role description:groupe d’onglet, accessibility description:missing value, focused:false, title:missing value, size:1920, 24, value:radio button Google of tab group 1 of group 2 of window Google of application process Safari, help:missing value, enabled:missing value, maximum value:missing value, role:AXTabGroup, entire contents:, subrole:missing value, selected:missing value, name:missing value, description:groupe d’onglet*)
class of UI elements of first UI element of group 2 of window 1
log result --> (*button, radio button*)
class of UI elements of group 1 of group 2 of window 1
log result --> (*group, button, menu button, menu button, menu button, menu button, button, button, button, button, menu button, button, menu button, button, button, button, menu button, button, button*)
title of every menu button of group 1 of group 2 of window 1
log result --> (*Apple, Geek, iOS, stockage, langage, MacPlus, VPC*)
keystroke "f" using {command down, control down}
delay 0.1
perform action "AXShowMenu" of toolbar 1 of group 2 of window 1
key code 125
keystroke return
end tell
end tell
*)