Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

347
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda