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

345
Views
How to get an HTML button disabled status (true or false) into AppleScript?

Buttons in webpages have a disabled status. This status can be true or false. if true, that means the button is greyed out on the webpage.

With Javascript, I can retrieve the status with this:

document.getElementById('view-more').disabled

it will either return true or false.

But if I combine this with AppleScript:

set buttonStatus to do Javascript "document.getElementById('view-more').disabled

Nothing gets returned about the status of the button.

The actual HTML code for the button is:

<button id="view-more" class="view_more">View more</button>

And when the button is disabled it becomes:

<button id="view-more" class="view_more" disabled="disabled">View more</button>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Using a simple HTML file with a disabled button, the following example AppleScript code works for me:

Example AppleScript code:

tell application "Safari"
    do JavaScript "document.getElementById('button').disabled;" in document 1
end tell



The contents of the HTML file as shown in Terminal:

% cat button.html
<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
    <button id="button" disabled>Button</button>
  </body>
</html>
% 

Screen Shot of Script Editor:

enter image description here




With the button enabled.

The contents of the HTML file as shown in Terminal:

% cat button.html
<!DOCTYPE html>
<html>
  <head>
  </head>
  <body>
    <button id="button">Button</button>
  </body>
</html>
% 

Screen Shot of Script Editor:

enter image description here

about 4 years ago · Juan Pablo Isaza Report
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!