Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

71
Views
Running JS with AppleScript

New to both JS and AppleScript!

The goal of the script is to click a button automatically within a web page using the Safari browser. I have gotten this to work successfully by using other JS methods (for example document.getElementByID(IDName).click();), however, I have to use the title of the button instead, since the ID for the button in this webpage is generated daily (meaning that the ID changes).

I have tested within the browser that document.querySelector('[title="Move to Next Day"]').click(); works to click the button, but getting it to work in my apple script has been an issue.

With my current code below I get an error that says, Expected “,” or “)” but found property. for the last line of code.

Here is my script:

to clickID(theId)
    tell application "Safari"
        do JavaScript "document.querySelector('" & theId & "').click();" in document 1
    end tell
end clickID

clickID('"[title="Move to Next Day"]"')
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!