Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

122
Vistas
Puppeteer Select Method Ignores Disabled Attribute

I have a disabled select element in an html file which I would like to check using puppeteer that it is in fact disabled. Unfortunately the page.select method seems to ignore the lock on the field element. Here is a stripped down example.

<!DOCTYPE html>
<html>
  <body>
    <select id='dropdown' disabled>
      <option value="op1">Option 1</option>
      <option value="op2">Option 2</option>
    </select>
  </body>
</html>

Now if I open this index.html I cannot change the select as expected but when interfacing with puppeteer using the page.select method I can.

const puppeteer = require('puppeteer');
const fs = require('fs');
(async () => {
  const browser = await puppeteer.launch( { headless: false} );
  const page = await browser.newPage();
  const content = fs.readFileSync('./index.html', 'utf8');
  await page.setContent(content);
  await page.select('#dropdown', 'op2');
})();

Now if I understand the puppeteer documentation correctly, then this should not result in the select option changing, but never the less it does. Am I missing something, or do I need to do something else in order to check that the element is locked.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda