ModifyHeader firefox extension and selenium webdriver

1,066 views
Skip to first unread message

Diwakar Sharma

unread,
Aug 28, 2013, 7:09:09 AM8/28/13
to seleniu...@googlegroups.com
Hi, 

I am using webdriver and my requirement is to modify headers on the go. Since it is not a native functionality of the webdriver, I am using firefox extension modifyheaders to get the job done. However, I have been unsuccessful in modify the header values. My code:

FirefoxProfile profile = new FirefoxProfile ();
profile.setPreference("network.proxy.socks", "socks.com");
profile.setPreference("network.proxy.socks_port", 10);
profile.setPreference("network.proxy.type", 1);
profile.addExtension(new File("C:/Selenium/modify_headers-0.7.1.1-fx.xpi"));
profile.setPreference("modifyheaders.config.active", true);
profile.setPreference("modifyheaders.config.openNewTab", true);
                        profile.setPreference("modifyheaders.config.migrated", true);
profile.setPreference("modifyheaders.config.alwaysOn", true);
profile.setPreference("modifyheaders.headers.count", 1);
profile.setPreference("modifyheaders.headers.action0", "Add");
profile.setPreference("modifyheaders.headers.name0", "X-Forwarded-For");
profile.setPreference("modifyheaders.headers.value0", "192.168.1.6");
profile.setPreference("modifyheaders.headers.enabled0", true);

I found this code from a few examples, but somehow this doesnot seem to be working here. What am I doing wrong here? Also, where can I find a copy of the extenxion .xpi file? 

Thanks in advance
Diwakar 
Message has been deleted

Diwakar Sharma

unread,
Aug 29, 2013, 4:56:18 AM8/29/13
to seleniu...@googlegroups.com
Can anyone comment on this please? thanks.

Christian LeMoussel

unread,
Aug 29, 2013, 7:37:37 AM8/29/13
to seleniu...@googlegroups.com
You can find a copy of the extenxion .xpi file here : http://ftp.mozilla.org/pub/mozilla.org/addons/967/

Perhaps modifyheaders.headers has values in array (JSON format ?)


Ankur Bohra

unread,
Oct 4, 2013, 9:56:47 AM10/4/13
to seleniu...@googlegroups.com
Thanks buddy...this really helped me...:-)

Andrew Yang

unread,
Aug 22, 2017, 10:58:04 PM8/22/17
to Selenium Users
  • Hello, I change the value to array,but this doesnot seem to be working.Can u show me the right format?Thank you very much.

在 2013年8月28日星期三 UTC+8下午7:09:09,Diwakar Sharma写道:
Reply all
Reply to author
Forward
0 new messages