Open Browser with custom headers

2,069 views
Skip to first unread message

Rekyn Gnik

unread,
Jul 12, 2016, 1:56:05 AM7/12/16
to robotframework-users
Hi, 

I am newbie working on a site which requires a header in order to navigate around it. 

How can I interact with the said site by using Open Browser keyword from the selenium library (or are there any other alternatives)? 

I am thinking of something like:  
${custom_header}= | Create Dictionary | key=value
Open Browser | http://www.google.com | gc | header=${custom_header}

This simulates the get request with an injected custom header. 

Thank you. 

Kevin O.

unread,
Jul 12, 2016, 9:30:10 AM7/12/16
to robotframework-users
This has been answered on SO: http://stackoverflow.com/q/15645093/2532697

There are plugins for both Firefox and Chrome (Modify Headers) that look like they would satisfy your needs. To support that using Selenium2Library, you could use an existing profile with those plugins instead of the clean temporary one you get otherwise.

Besides Browsermob-proxy there is also Fiddler.

I would push back if you can :) Selenium is for simulating real browser usage and end users do not set custom headers.

Kevin

Rekyn Gnik

unread,
Jul 12, 2016, 9:46:10 PM7/12/16
to robotframework-users
Hi Kevin,

Thanks for the answer. 

The part where you said, "you could use an existing profile with those plugins instead of the clean temporary one you get otherwise.", how do you do this in robot framework?
Reply all
Reply to author
Forward
0 new messages