I want to automate the signup process but I'm unable to check the box using Playwright. Each time I click on the checkbox, I am redirected to a new link. In the DOM, when the checkbox is checked, the class of the parent element changes from invalid to valid.
import re
from playwright.sync_api import sync_playwright
def test_example() -> None:
with sync_playwright() as p:
browser = p.chromium.launch(headless=False, slow_mo=2000)
context = browser.new_context()
page = context.new_page()
page.goto("https://www.softr.io/templates/inventory-management")
page.locator('//button[@data-cky-tag="accept-button"]').click()
page.locator('//span[contains(normalize-space(text()), "Sign up for free")]').click()
page.locator('//input[@placeholder="Full Name"]').fill("tairtable")
page.locator('//input[@placeholder="Email"]').fill('[email protected]')
page.locator('//input[@placeholder="Password"]').fill('Xyz@12345678')
# Click on the checkbox that opens a new window
with context.expect_page() as new_page_info:
page.locator('//div[@class="sw-checkbox ng-tns-c689136354-0"]//label').click()
new_page = new_page_info.value
# Perform any actions on the new page if needed
new_page.close()
# Return to the original page
page.locator('//button[contains(normalize-space(text()), "Sign up for free")]').click()
test_example()
expected is checkbox should be checked