How to get request HTML headers

Hi, are there any chance I could get HTML headers using robot framework?

For example, I want to get a certain request header in the HTML request.

for example I want to get the request cookie of this

would it be possible?


Hi, for example with the RESTinstance library you can use the Output keyword to get the headers.

E.g ${headers}= Output response headers (or request headers) will store the response or request headers to a variable called headers.

Hi Asimell,

would it the get request of coming from the frontend? like the actual page of google .com for example. the landing page request?

Thanks and regards

like this example,

I want to get the details of those in the red box.

Thank you.

Hi Robot Man,

There are several libraries that provide this functionality, depends on what you are using?

some examples:

There may also be a way to do it with SeleniumLibrary using seleniumtestability but I don’t know how to do that.

Hope this helps,


Hi @damies13,

Thank you for your kind response. Based on that libraries I think it will return response object of a site. What I want to extract si the request. Hopefully there is a way to extract the request. Thank you!

Hi Robot Man,

There are 3 types of request headers:

  • ones you set yourself manually, those libraries will allow you to do that if you need to
  • ones that are set automatically by the browser (user-agent, referrer, etc)
  • ones that get set automatically earlier by either
    • a response header (see previous answer)
    • or by javascript in the browser (this is rare, but if this is your cases, get the text of the relevant script element and then parse it to find the value)

Regardless which of these it is, you can infer what the request header will be before hand.