In a particularly 'pesky' website, a dialog box pops up to block (or cover) automated entry of the userid input box.
I have used the following code attempting to get a reference & to close this window, but have been unsuccessful.
tell application "System Events"
key code 15 using {command down}
key code 36 // return key
end tell
tell application "System Events" to tell process "Safari"
set numSheets to (count of sheets) & " sheets" as text // 0 sheets
end tell
set numDocuments to (count of documents) & " documents" as text // 1 documents
set numWindows to (count of windows) & " windows" as text // 1 sheets
What else is available to find and close that alert box?
Edit: The key code 36
will sometimes close the alert, and other times, when it's not present, will submit the page too early.