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

268
Vistas
How click checkbox with CSS locator ::after using playwright

I have to click checkbox for term & conditions. I have used .click() and .check in my code. But when I am running the code, it's clicking on the terms & conditions and it's redirecting to another page. can you suggest any help. below is my html enter image description here

When I hover mouse to ::before and ::after checkbox is highlighting. enter image description here

await this.page.locator('#lb-confirm').click()

await this.page.locator('#lb-confirm').check

Edit: I have tried with jquery in console and able to click checkbox. $('#dr-cb-confirm').trigger('click') with above code, how can I convert to playwright code. I have tried with below code await page.locator(''#dr-cb-confirm').click() .. Playwright was tried to click and but not finally it was exited from execution.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I found the solution. Since I was unable to click checkbox, I have jQuery to click the checkbox $('#dr-cb-confirm').trigger('click') . When I want to call the jQuery command in playwright I have installed jQuery library using npm i --save-dev @types/jquery. Then I have updated my code with jQuery await this.page.evaluate(() => $('#dr-cb-confirm').trigger('click'))

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