api - Robot Framework Requests Library: set session cookie -


i trying create session using requestslibrary in robot framework. first api call "authentication step". step requires store cookie remainder of api calls. normally, use

curl -c cookie.txt -d  "j_username=foo%40inq.com&j_password=pass123&submit=login" https://api.company.com/j_spring_security_check 

but understand it, requestslibrary doesn't support curl commands? below example of code i'm trying execute

*** settings *** documentation       api  library     requestslibrary library     collections *** variables *** ${headers}      create dictionary    content-type    application/json    accept    application/json *** test cases *** tester create session    tc  https://api.company.com/j_spring_security_check?j_username=regression1@att&j_password=tcpass1234&submit=login  ${headers}  cookies.txt 

it works if leave cookie param none, unable run remainder of test:

${result}=  post request       tc       https://api.company.com/engagementapi/v1/agent/login?username=regression1@att&password=tcpass1234&output=json     headers = ${headers} 

the post works, i'm not getting desired response when run in swagger ui

thanks

the cookies parameter needs contain actual cookies dictionary, not filename.

for example:

${cookies}=  create dictionary   foo=bar   create session  session  ${url}  cookies=${cookies} 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -