title: Matcher error: received value must not be null nor undefined
body: <p>I am using expect in typescript to write an assertion while writing a Then step definition using typescript in in playwright
  I have assigned an the class on this url <a href="https://www.gov.uk/help/accessibility-statement" rel="nofollow noreferrer">https://www.gov.uk/help/accessibility-statement</a> to confirm I can see accessibility statement when I land on the page.</p>
  <p>I then get an undefined error when I run my tests.</p>
  <p>Code written:-</p>
  <pre><code>import expect from &quot;expect&quot;;
  
  Then(&quot;I expect to be on the accessibility page&quot;, async function(
      
  this: OurWorld
  ) 
  
  {   
  
      const {page} = this;
      // eslint-disable-next-line no-debugger
      const headMessage =await page?.$(&quot;.gem-c-title__text.govuk-heading-xl&quot;)
      console.log(headMessage)
      expect (headMessage).toContainEqual((&quot;Accessibility statement&quot;)
          
      );
  });
  </code></pre>
  <p>I would like to check that the accessibility icon on the accessibility page contains the text accessibility.</p>
  <p>The error I am getting back is this:-</p>
  <pre><code>× Then I expect to be on the accessibility page # step-definitions\feature.step-definitions.ts:28
         Error: expect(received).toContainEqual(expected) // deep equality
  
         Matcher error: received value must not be null nor undefined
  </code></pre>
  <p>Thank you for your help</p>