Robot framework pass cookie to get request (RequestsLibrary) - TypeError

时光怂恿深爱的人放手 提交于 2019-12-04 13:54:15

Sooo finally found the solution:

    Do Local Login  ${username}    ${password}
    ${cookie_value}=  Get Cookie Value  JSESSIONID
    ${dict}=  Create Dictionary   JSESSIONID=${cookie_value}
    Create Session  session1  https://oururl.com  verify=${False}  cookies=${dict}
    ${resp}=  Get request  session1  /somepage/request

Keyword Create Session works with the cookie, just the cookie must be passed not just as a cookie value, but dictionary JSESSIONID=${cookie_value}. Alternatively I don't have to pass the cookie in Create Session but in Get Request, just then I have to make the cookie as dictionary like ${dict}= Create Dictionary Cookie=JSESSIONID=${cookie_value} and this pass into Get request session1 /somepage/request headers=${dict}

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!