Synthetic Monitoring


I have this error on my synthetics test on Uptime Module: Evaluation failed: DOMException: Failed to execute 'evaluate' on 'Document': The string '[href=/observability]' is not a valid XPath expression.


      script: |-
        step("load homepage", async () => {
            await page.goto('');
        step("hover over products menu", async () => {
            await page.hover('css=[data-nav-item=products]');
        step("click observability product", async () => {

Any ideas of what could be the problem?

Hi Rossana. Thanks for reaching out.

You'll want to include the expected HTML element tag in your selector. Also, note that you can start XPath selectors with // as syntactic sugar.

More on XPath selectors with Playwright: Selectors | Playwright

I would try await"//a[contains(@href, '/observability')]");. Let me know how it goes!

1 Like


Thank you.

It works!!! :slight_smile:

This topic was automatically closed 24 days after the last reply. New replies are no longer allowed.