${Response}= GET On Session mysession /?test=${test}&fl_date=${fl_date}&fl_placement=${fl_placement}&fl_category=${fl_category}&fl_type=${fl_type}&fl_store=${fl_store} headers=${headers}
Log To Console ${Response.content}
ISSUE:- All spaces are proper & i am able to get the response. The issue is, session id node is not retrieved & the complete image code.
The answer is likely to be in the request headers, body or cookies, but you didn’t share a comparison of the request details only the response body, so we can see the problem but can’t offer any help to solve the problem.
I suggest you compare each and every entry in the request headers, request body and request cookies and add any that are missing, remove any extras (if there are any extras) and you will probably find the solution.
There are a few potential issues I see here, so these suggestions should give you a starting point:
${bearer-token} variable, it looks like there are 2 spaces between the word token and the token string, 2+ spaces has special meaning in Robot Framework, so if you need 2 spaces there you’ll need to escape the second one or just use the ${SAPCE} variable i.e. token${SAPCE}${SAPCE}a30b537.....
csrftoken in the cookies, these tokens are usually issued by the application web server, they usually have a limited life span (they are a type of session cookie) typically in the 15-30 minute range
back to ${bearer-token}, the token value itself looks like a session authorisation token so again this would probably be issued by the application web server, and probably has a limited life span typically in the 30-60 minute range
Guessing you’re going to be testing more than 1 api call? To resolve 2 & 3 I would suggest you create a API login keyword that does the following:
create the Requests session
hit the ${baseURL} to get the csrftoken and set that in the cookies (may happen automatically?)
post a login request with a username/password to get the server generated Authorization Token and then set this as a suite variable ${bearer-token}
Then you can just call API login keyword in all your tests or make it a [test / suite] startup keyword
As for the other cookies, I cant see most of them in your robot file but looking at the devtools screen shot, these you should pay attention to:
anything starting with _ga is related to google analytics, you can probably ignore them, your application probably doesn’t use them
authtoken cookie, see point 3 above
authprofile looks similar to authtoken, probably also generated by login
userid looks similar to authtoken, probably also generated by login
Your devs should be able to tell you more detail about how to perform a login call to generate those cookie values.
Surely, i will be doing the changes you suggested for point 2.
For point 3, i have tried the same token & executed the request from Postman & i am able to get all the nodes.
So, i believe the span of bearer-token is alive. Even then, in response from requestslibrary, i am not getting the same results.
Not sure what else to tell you, the issue is not Robot framework or requests library, you are getting a valid response, it’s just your request is missing something that your AUT needs before it will return the data you are expecting.
Your application developers should be able to look at the request on the server side and tell you what is missing, as I don’t know the details of your application I have given you generic suggestions based on my experience with many applications, but I can’t know the specifics of your application.