# Synthetic Monitoring

**URL:** <https://discuss.elastic.co/t/synthetic-monitoring/302002>\
**Category:** Synthetics\
**Created:** [April 8, 2022, 9:54pm UTC](https://discuss.elastic.co/t/synthetic-monitoring/302002 "2022-04-08T21:54:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rossana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rossana/32/94216_2.png) [@Rossana](https://discuss.elastic.co/u/Rossana)\
**Post date:** [April 8, 2022, 9:54pm UTC](https://discuss.elastic.co/t/synthetic-monitoring/302002/1 "2022-04-08T21:54:44Z")

</div>

Hi,

I have this error on my synthetics test on Uptime Module:

`page.click: Evaluation failed: DOMException: Failed to execute 'evaluate' on 'Document': The string '[href=/observability]' is not a valid XPath expression.`

Configuration:

```auto
      script: |-
        step("load homepage", async () => {
            await page.goto('https://www.elastic.co');
        });
        step("hover over products menu", async () => {
            await page.hover('css=[data-nav-item=products]');
        });
        step("click observability product", async () => {
            await page.click('xpath=[href=/observability]');
        });

```

Any ideas of what could be the problem?

---

<div class="post-metadata">

**Author:** ![Dominique\_Clarke](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dominique_clarke/32/92223_2.png) [@Dominique\_Clarke](https://discuss.elastic.co/u/Dominique_Clarke)\
**Post date:** [April 11, 2022, 6:33pm UTC](https://discuss.elastic.co/t/synthetic-monitoring/302002/2 "2022-04-11T18:33:43Z")

</div>

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](https://playwright.dev/docs/selectors#xpath-selectors)

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

---

<div class="post-metadata">

**Author:** ![Rossana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rossana/32/94216_2.png) [@Rossana](https://discuss.elastic.co/u/Rossana)\
**Post date:** [April 12, 2022, 4:56pm UTC](https://discuss.elastic.co/t/synthetic-monitoring/302002/3 "2022-04-12T16:56:17Z")

</div>

Hi,

Thank you.

It works!!! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 6, 2022, 4:56pm UTC](https://discuss.elastic.co/t/synthetic-monitoring/302002/4 "2022-05-06T16:56:41Z")

</div>

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