According to the official documentation, playwright doesn’t support chaining the actions you perform on a single selector, like alternatively Cypress allows for.
In result, your code file grows with repetitive expressions:
await page.getByRole('textbox').click();
await page.getByRole('textbox').fill('test value in the text box');
await page.getByRole('textbox').press('Enter');
What I’m trying to achieve is that after you perform a click, you can subsequently, perform a fill and maybe also a press, if it’s programmaticaly possible, in a single expression. Without repeating
await page.getByRole('textbox')
I’m fairly new to javascript and typescript. I’m reading documentation, but feeling overwhelmed. Would be super grateful for any guidance concerning if e.g. promises would solve this issue, with an example on the above code provided.
Using “@playwright/test”: “^1.28.0”