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

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;

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:

=========================== 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;

  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

Rubberduck!

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

1 Like

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.

1 Like