# Wait For (Response/Navigation) and possible issues with url matcher?

**URL:** <https://forum.robotframework.org/t/wait-for-response-navigation-and-possible-issues-with-url-matcher/8122>\
**Category:** Browser\
**Created:** [3 December 2024 11:10 UTC](https://forum.robotframework.org/t/wait-for-response-navigation-and-possible-issues-with-url-matcher/8122 "2024-12-03T11:10:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rasjani](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@rasjani](https://forum.robotframework.org/u/rasjani)\
**Post date:** [3 December 2024 11:10 UTC](https://forum.robotframework.org/t/wait-for-response-navigation-and-possible-issues-with-url-matcher/8122/1 "2024-12-03T11:10:16Z")

</div>

Been having problems of not catching neither `Wait For Response` or `Wait For Navigation` for one particular case.

I have following kw that uses both depending on a passed in boolean;

```python
Verify Navigation
  [Arguments]
  ... ${url}
  ... ${keyword}
  ... ${arg}
  ... ${use_navigation}=${False}
  ... ${timeout}=10 seconds
  ... ${wait_until}=domcontentloaded

  IF ${use_navigation} == ${True}
    ${promise}= Promise To
    ... Wait For Navigation
    ... ${url}
    ... timeout=${timeout}
    ... wait_until=${wait_until}

    Run Keyword ${keyword} ${arg}
    Wait For ${promise}
  ELSE
    ${promise}= Promise To
    ... Wait For Response
    ... matcher=${url}
    ... timeout=${timeout}

    Run Keyword ${keyword} ${arg}
    ${response}= Wait For ${promise}
  END

```

And in this particular case, both Navigation& Response times and my assumption is the url matcher.

At the moment, this pretty much sums things up _if i use navigation_:

```python
=========================== logs ===========================
waiting for navigation until "commit"
navigated to "https://my.dev.env/testi-kauppa/checkout/xxxxx/productselection?id=7cfee50b-0299-4b24-9902-f67e4876466b&cartId=24338-9660-10001364-76543373"
navigated to "https://my.dev.env/testi-kauppa/checkout/xxxxx/productselection?id=7cfee50b-0299-4b24-9902-f67e4876466b&cartId=24338-9660-10001364-76543373"
============================================================

```

And that `**/productionselection?*` is the URL i want get into when my click event happens. My calling side looks something like this;

```python
  Verify Navigation
  ... /testi-kauppa/checkout/xxxxx/productselection?id=[\d\w-]{36}&cartId=[\d\w-]{28}/
  ... Click
  ... ${BUTTON_SEND}
  ... use_navigation=${True}
  ... timeout=30 seconds
  ... wait_until=commit

```

So, the first argument

- `/testi-kauppa/checkout/hbbmbb/productselection?id=[\d\w-]{36}&cartId=[\d\w-]{28}/`

definitely matches as RegEx except the fact that `/` is not escaped.

But even with escapes like this:

- `/testi-kauppa\/checkout\/hbbmbb\/productselection?id=[\d\w-]{36}&cartId=[\d\w-]{28}/`

This verification still times out. Tried escaping \d to \d \w to \w … still same.

Process of what happens here is that im filling a form that gets submitted to backend and backend replies with 302 and a new url to productselection.

Anyone with good ideas on how to approach this ? My assumption is either

1. Response / Navigation happens fast and Promise doesn’t catch that ?
2. I do not have a working url matcher

---

<div class="post-metadata">

**Author:** ![rasjani](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@rasjani](https://forum.robotframework.org/u/rasjani)\
**Post date:** [3 December 2024 11:38 UTC](https://forum.robotframework.org/t/wait-for-response-navigation-and-possible-issues-with-url-matcher/8122/2 "2024-12-03T11:38:18Z")

</div>

Rubberduck!

`/testi-kauppa\/checkout\/xxxxx\/productselection\\?id=[\\d\\w-]{36}&cartId=[\\d\\w-]{28}/` works …

---

<div class="post-metadata">

**Author:** ![rasjani](https://avatars.discourse-cdn.com/v4/letter/r/858c86/32.png) [@rasjani](https://forum.robotframework.org/u/rasjani)\
**Post date:** [3 December 2024 12:08 UTC](https://forum.robotframework.org/t/wait-for-response-navigation-and-possible-issues-with-url-matcher/8122/3 "2024-12-03T12:08:15Z")

</div>

As a side note: Wait For Navigation now works with the given regex _but_ if i use `Get Url matches ${matcher}` where matcher starts and ends with `/``Get Url` will fail but if i remove leading and trailing `/`, Get Url will pass.
