Set request header and User Agent in Geb
Asked Answered
G

1

6

When using Geb, is it possible to set custom request headers and user agent when using the Browser API (and not the Direct Download API)?

While this is possible with the FirefoxDriver (see here), I am looking for a way of doing this with the WebKitDriver.

Gruesome answered 22/8, 2012 at 6:25 Comment(1)
Hey..Did you find any solution? I am looking for similar solution.Lilah
I
0

A possible solution is via a proxy.

  • BrowserMob has a standalone mode with REST api, or embedded in your test programmatically: https://github.com/webmetrics/browsermob-proxy . Useful when there are a lot of custom headers you want to test.
  • If you already have Apache, you can create another VirtualHost on a different port having that particular request header, and point your browser to that port before the test. Given that your header doesn't change between tests.

This might not be the direct solution to your question: modify request headers directly in Browser API, but it achieves the end result.

Introit answered 21/3, 2013 at 22:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.