I want to test meta tags of the web application in Playwright, but I haven't found any info in the official documentation. Can somebody advise me with meta data testing?
For example, I have tried to test:
<meta name="description" content="something">
test("Meta data", async ({ page }) => {
await page.goto(env.baseUrl)
const metaDescription = page.locator('meta [name="description"]')
await expect(metaDescription).toHaveText("something")})
and the result is:
- The received string is ""
- waiting for selector 'meta [name="description"]'
What is wrong and how to test it in the right way?