Skip to content

Add keyword to get all cookie information #932

@pekkaklarck

Description

@pekkaklarck

We currently have Get Cookie Value but it only returns the value, not other information such as expiry. We have few possibilities how this could be implemented:

  1. Enhance the existing Get Cookie Value to allow returning other info too. For backwards compatibility reasons its default behavior cannot change, but it could get a new optional argument like info='value' that could be used like this:

     ${value} =    Get Cookie Value    name
     Log    ${value}
     ${expiry} =    Get Cookie Value    name    info=expiry
     Log    ${expiry}
    
  2. Add separate new keyword like Get Cookie or Get Cookie Information that returns a custom object containing all cookie information in its attributes. This info could then be used in the data easily:

     ${cookie} =    Get Cookie    name
     Log    ${cookie.value}
     Log    ${cookie.expiry}
    
  3. Enhance the existing Get Cookie Value to return an object with all the cookie information.

My favorite is option 2. If we decide to do that, then we could consider deprecating the existing Get Cookie Value. We should also think what to do with the current Get Cookies which returns a string in format cookie1=value1; cookie2=value2. It should rather return a list of cookie objects, but that change would be backwards incompatible. I have an idea how it could be deprecated pretty gracefully, though.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions