1

Bitten off more than I can chew with this one. It's my first time trying to use AppleScript to automate Safari (while at the same time trying to figure out HTML). I've found examples to show me how to do this and have made it work for some very simple websites, but can't make it work for the website I'm trying to use.

I'm trying to navigate this website https://app.ssm.gov.mo/healthPHD/ using Automator with AppleScript commands.

On the third page in, when I go to the Safari console and input something like document.getElementById('btnSubmit').click() to submit the form, it works just fine.

However, when I add an AppleScript command in Automator as follows, it doesn't work:

tell application "Safari"
    activate
    tell document 1
        do JavaScript "document.getElementById('btnSubmit').click();"
    end tell
end tell

Also, I'm aware of the command document.forms[0].elements[0].checked=true for selecting checkboxes, but this doesn't seem to work for the checkboxes on this website as they are nested within the various Frames and Div parts. How do I go about navigating the frames and divs so as to select some of the checkboxes on this website before issuing the submit command?

Thanks.

RustyFlyer
  • 11
  • 1
  • I think you are asking too much (or: special) as anybody trying to "surf" your website has to consent to the site's requirements, has to enter personal information etc. just to reach "your" submit button. THAT I won't do but can refer you to an answer here that explains how to get relevant info. E.g. the button at the top [Ask Question] is a: >static text "Ask Question" of UI element […] of window "[THIS]" of application process […]< How-to-get-info: https://stackoverflow.com/questions/69773562/is-it-possible-to-programmatically-change-the-xdr-display-reference-mode-aka-pr/69788185#69788185 – clemsam lang Nov 01 '21 at 15:34
  • [follow-up:] As you are planning to use an Applescript anyway you might also use AS*'s object definitions instead of mixing javascript into it, I (personally) think. Sounds more "consistent" to me … – clemsam lang Nov 01 '21 at 15:37

0 Answers0