Search code examples
karateui-automation

How to modify headers for UI Test in karate


how can we add a custom header to UI test in karate like selenium-wire. details on link https://www.smashingmagazine.com/2021/12/headers-https-requests-ui-automation-testing/

is there any provision for this in karate?


Solution

  • You can do this by intercepting requests, this works in Chrome only: https://github.com/karatelabs/karate/tree/master/karate-core/#driverintercept

    In the mock, you can add headers and then "proceed" with the outgoing request.

    This seems to be a very rarely needed use-case. You are welcome to contribute code to improve Karate.