using Playwright automation I would like to insert email into a simple input field:
The site code how the Input is defined:
My code in Playwright:
form = page.locator("#register-email").click()
form.fill("[email protected]")
The result is error "object has no attribute 'fill'":
form = page.locator("#register-email").click()
> form.fill("[email protected]")
E AttributeError: 'NoneType' object has no attribute 'fill'
Any idea, what could be wrong?
The way you have written this code, form
is assigned to the result of click()
, which returns nothing:
form = page.locator("#register-email").click()
I believe you should separate that code into two statements:
form = page.locator("#register-email")
form.click()