tell application "Safari"
close every window
make new document
activate
end tell
tell application "System Events"
click menu item "Clear History…" of menu 1 of menu bar item "History" of menu bar 1 of process "Safari"
try
click pop up button 1 of window 1 of process "Safari"
click menu item "all history" of menu 1 of pop up button 1 of window 1 of process "Safari"
click button "Clear History" of front window of process "Safari"
tell application "Safari" to close every window
on error
try
click pop up button 1 of sheet 1 of window 1 of process "Safari"
click menu item "all history" of menu 1 of pop up button 1 of sheet 1 of window 1 of process "Safari"
click button "Clear History" of sheet 1 of window 1 of process "Safari"
tell application "Safari" to close every window
end try
end try
end tell
← Back to Articles