Set request header and User Agent in Geb

When using Geb, is it possible to customize the headers of user requests and the user agent when using the browser API (and not the direct download API)?

Although this is possible with FirefoxDriver (see here ), I am looking for a way to do this using WebKitDriver.

+6
source share
1 answer

A possible solution is through a proxy.

  • BrowserMob has a standalone mode with a REST api or software built into your test: https://github.com/webmetrics/browsermob-proxy . Useful when there are many custom headers that you want to test.
  • If you already have Apache, you can create another VirtualHost on another port that has this specific request header and point the browser to that port before testing. Given that your title does not change between tests.

This may not be a direct solution to your question: change the request headers directly in the browser API, but it will achieve the final result.

0
source

Source: https://habr.com/ru/post/923452/


All Articles