title: Playwright how to wait for locator that matches multiple elements to not be visible
body: <p>I am trying to wait for an element that indicates a page is still loading, and exists on the page multiple time, to not be visible (think table with loading data placeholders).</p>
  <p>Playwright documentation suggests using Locators is best practice, and therefore I initially tried to achieve this by doing:</p>
  <pre><code>locator.waitFor({state: &quot;hidden&quot;)
  </code></pre>
  <p>However that errors due to Locators being strict and only being allow to match one element.</p>
  <p>I'm now doing it with the following code:</p>
  <pre><code>page.waitForSelector(&quot;.foo .bar&quot;, {state: &quot;hidden&quot;})
  </code></pre>
  <p>This is non-ideal for a couple of reasons:</p>
  <ul>
  <li>I'm storing page elements as locators in the Page Object Model, and you seemingly cannot access the selector of a locator, meaning the selector is duplicated in the code</li>
  <li>I believe page.waitForSelector will use an ElementHandle which is discouraged</li>
  </ul>
  <p>Is there any way to turn off the strictness constraint on a Locator? Or a way to achieve this using the Locator. I'm aware you can do <code>.count</code> on a Locator which matches multiple elements, but I've not found a nice way to combine that with waiting for the count to be 0.</p>