Sponsored Link
Looking for a unified way to  viewmonitor, and  debug Playwright Test Automation runs?
Try the Playwright Dashboard by today. Use the coupon code PWSOL10 for a 12 month 10% discount.

How do I find a locator that keeps disappearing in Chrome for a Playwright UI Test?

I know I've run into this issue many times before. It feels like I am in a race to select the element and get a glimpse of the console to actually get the element name.

This simple tip may help you keep that drop down or popup visible while interacting with it.

We will be using Chrome Dev Tools feature "Emulate a focused page". With Chrome Dev Tools Open on a Mac use [⌘ or Ctrl]+[P] Command Menu and search for >emulate a focused page and hit Enter.

This will keep certain elements focused so they are selectable.

To try this out for yourself you can visit MDN Docs and attempt to inspect one of the search results from the search box.


Thanks @sulco for the inspiration.