# How to get request HTML headers

**URL:** <https://forum.robotframework.org/t/how-to-get-request-html-headers/2575>\
**Category:** Robot Framework\
**Created:** [15 October 2021 09:03 UTC](https://forum.robotframework.org/t/how-to-get-request-html-headers/2575 "2021-10-15T09:03:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![robot](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@robot](https://forum.robotframework.org/u/robot)\
**Post date:** [15 October 2021 09:03 UTC](https://forum.robotframework.org/t/how-to-get-request-html-headers/2575/1 "2021-10-15T09:03:20Z")

</div>

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 [google.com](http://google.com).

would it be possible?

Thanks

---

<div class="post-metadata">

**Author:** ![asimell](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/asimell/32/703_2.png) [@asimell](https://forum.robotframework.org/u/asimell)\
**Post date:** [15 October 2021 10:48 UTC](https://forum.robotframework.org/t/how-to-get-request-html-headers/2575/2 "2021-10-15T10:48:39Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![robot](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@robot](https://forum.robotframework.org/u/robot)\
**Post date:** [15 October 2021 14:01 UTC](https://forum.robotframework.org/t/how-to-get-request-html-headers/2575/3 "2021-10-15T14:01:04Z")

</div>

> [@asimell](#):
>
> RESTinstance

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

---

<div class="post-metadata">

**Author:** ![robot](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@robot](https://forum.robotframework.org/u/robot)\
**Post date:** [15 October 2021 15:37 UTC](https://forum.robotframework.org/t/how-to-get-request-html-headers/2575/4 "2021-10-15T15:37:02Z")

</div>

like this example,

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

 ![Screen Shot 2021-10-15 at 11.35.32 PM](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/f/f0cb8353757dfa28881ee90841d9956de374396c.jpeg)

Thank you.

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [15 October 2021 23:14 UTC](https://forum.robotframework.org/t/how-to-get-request-html-headers/2575/5 "2021-10-15T23:14:00Z")

</div>

Hi Robot Man,

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

some examples:

- [Wait For Response](https://marketsquare.github.io/robotframework-browser/Browser.html#Wait%20For%20Response)
- [Response Object](https://robotframework-requests.netlify.app/doc/requestslibrary#Response%20Object)

There may also be a way to do it with SeleniumLibrary using [seleniumtestability](https://github.com/rasjani/robotframework-seleniumtestability) but I don’t know how to do that.

Hope this helps,

Dave.

---

<div class="post-metadata">

**Author:** ![robot](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@robot](https://forum.robotframework.org/u/robot)\
**Post date:** [17 October 2021 06:34 UTC](https://forum.robotframework.org/t/how-to-get-request-html-headers/2575/6 "2021-10-17T06:34:36Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [17 October 2021 12:49 UTC](https://forum.robotframework.org/t/how-to-get-request-html-headers/2575/7 "2021-10-17T12:49:35Z")

</div>

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.

Dave.
