Wait For Response keyword hangs

Hello all,

I am having trouble getting expected result from Wait For Response keyword. The keyword hangs and waits for response in a situation that to me seems like the response condition is met.

I have defined the request URL as a separate variable

${URL}    **/post/items/cart**

and the keyword is called as

Wait for response    ${URL}

In developer tools I can see that the URL gets a “200 OK” response. The double asterisks on both ends of URL are needed since HTTP address port changes with each session, as does a special session query parameter at the end of URL.

I was not able to figure out what I could be missing. Any insight will be most welcome.

Thank you and best regards,
JC

Based on the documentation (never used this keyword) what you have should be fine…

Couple questions:

  • What action are you carrying out before this keyword? At a guess this is the click to submit your cart item(s), in the test is this successful? As that could be why it looks to be hanging as it cannot find the post url…
  • Is it possible to show the entirety of the url for the post could be helpful

Thanks

Hi JC,

Expanding on what @_daryl said, it seems your script is adding something to a shopping cart, have you filled in all the mandatory fields for this item to be added to the cart?

I’ve seen shopping cart systems where one item has 1 mandatory field for quantity which defaulted to 1, and then other items with up to 10 mandatory fields where some of the mandatory fields have no value.

Also check the response body, what did you get back, yeah you got a 200 ok, but did the body say something like “mandatory field xxxxxx not valid”?

Also I’ve seen applications that return 200 ok with a .NET stack trace in the body, so always check the body is what you expected.

Dave.

Hello, thank you @_daryl and @damies13 for replies.

That’s right, before the keyword a click to submit cart item is performed. On front end everything looks fine and API response does not contain any errors either.
I can get back with the entire URL at a later time. Although, if ** signs work as expected, I can hardly see what could go wrong here.

The application and actions in it are okay. I got around the issue by waiting for state of an UI element to change and the test works alright. I don’t feel like it is the nicest solution, and surely at some point I will have to use Wait for response keyword, so not figuring it out still bothers me.

Best regards