Hi, I need to run two actions synchronously in an async function. How can I do this? If I await every step when playwright switches between browser_contexts, the previous step is lost, so when it comes back I cannot find what it was doing. How can I link 2 steps together in a single block?
These are currently my two lines of code
await page.get_by_role("textbox", name="To").fill(destination)
await page.get_by_text(destination, exact=True ).click()
What I would need is something like:
await page.get_by_role("textbox", name="To").fill(destination)
page.get_by_text(destination, exact=True ).click()
But I get an error if I try to run this code. In essence, once it fills the destination information in the cell, it has to immediately click on the text that appears. If it switches to another tab it will be lost.
This thread is trying to answer question "How can the user run two actions synchronously in an async function without losing the previous step when playwright switches between browser contexts?"
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].