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

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

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 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