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

227
Views
¿Cómo comprobar si existe un botón?

Estoy aprendiendo a crear una extensión de Chrome. Quiero crear una extensión para encontrar un botón y mostrar alertas que lo encontraron

el boton es

 <button class="bt bt-sm text-white btn-flashing" style="background-color: #fd7e14; margin:3px" disabled="">ABC - 01</button>

Entonces, ¿cómo puedo escribir un script para encontrar eso?

Tengo un script para mostrar la alerta.

 chrome.browserAction.onClicked.addListener(function() { alert("found it"); })

Gracias.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

chrome.browserAction.onClicked.addListener(function() { //Checking if there are any results of the button with that class if(document.querySelectorAll('.bt bt-sm text-white btn-flashing').length >= 1){ //Found results of the button }else{ //Found no results of the button });

Todo este código dice que si hay más de 0 ocurrencias de ".bt bt-sm text white btn-flashing", entonces encontró resultados.

about 4 years ago · Juan Pablo Isaza Report

0

Puede utilizar un script de contenido para comprobar la presencia del botón.

Por ejemplo:

 chrome.browserAction.onClicked.addListener(function(){ chrome.tabs.executeScript({ code: 'document.querySelector("button.bt.bt-sm.text-white.btn-flashing")' }, function(result) { if (result[0]) { alert('found it'); } else { alert('not found'); } }); });
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!