This thread is trying to answer question "How to check if an icon with a custom property exists on a page?"
Do you want to check on a specific icon element that you can write a locator for? In that case you can use https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-attribute
If you want to know if there is any at all you would have a special locator for it, something like page.locator("mat-icon[tag='value']") . And check if it is attached or visible.
Idk if it would work to use the locator like this, but I think I would prefer writing it like this: page.locator('mat-icon').locator('tag=value')
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 firstname.lastname@example.org.