For the terms & conditions checkbox, I have attempted to use both .click()
and .check
functions in my code. However, when running the code, it seems to click on the checkbox and redirect to another page. Any suggestions on how to fix this issue?
Below is a snippet of my HTML:
https://i.sstatic.net/dH0NA.png
Additionally, when hovering over the ::before
and ::after
elements of the checkbox, it highlights.
https://i.sstatic.net/oa4i2.png
await this.page.locator('#lb-confirm').click()
await this.page.locator('#lb-confirm').check
Edit: I've experimented with jQuery in the console and was able to successfully click the checkbox using:
$('#dr-cb-confirm').trigger('click')
How can I convert this functionality into Playwright code? I've tried the following:
await page.locator('#dr-cb-confirm').click()
.. Although Playwright attempts to click, it eventually exits without completing the action.