One of several buttons may appear on the page, I have to wait for the first one and perform the action, with Selenium I did it this way:
element = WebDriverWait(driver, 20).until(
lambda driver: \
driver.find_element(By.NAME, "Confirm") or \
driver.find_element(By.NAME, "Edit") or \
driver.find_element(By.NAME, "Submit")
)
Is there any equivalent at playwright?
Well, I haven't figured it out how to do this natively with Playwright but in js you can use
await Promise.race([selector1, slector2, selector3])
and the test will proceed with the first one that resolves. Probably you can adopt a similar concept in python with
asyncio.wait(selectors_set, return_when=asyncio.FIRST_COMPLETED)