Setting Scripted Browser Header

Hi

I’m trying to manipulate “Accept-Language” header of a scripted browser. Here is my script:

var assert = require('assert');

$browser.addHeader('Accept-Language', 'fr-FR,fr;q=0.9')
$browser.get('http://httpbin.org/headers').then(function(){
  $browser.takeScreenshot()
})

However both screenshot and request headers shows that language is still English.

What am I doing wrong?


New Relic edit

  • I want this, too
  • I have more info to share (reply below)
  • I have a solution for this

0 voters

We take feature ideas seriously and our product managers review every one when plotting their roadmaps. However, there is no guarantee this feature will be implemented. This post ensures the idea is put on the table and discussed though. So please vote and share your extra details with our team.

A small update. With the code above I can set “Accept”, “User-Agent” headers but not “Accept-Language”. This looks like either bug or explicit restriction.

Hey @tim.bezhashvyly

Looks like you have discovered a limitation of the Synthetics environment. In order to change the language headers, we would need to alter the Chrome options which are not exposed to the scripting environment. Any attempts to change the Accept-Language header are ignored and replaced with the default as you have discovered.

I’ll get this logged as a feature request for you though! The product management teams will see that and be able to make future implementation decisions based on these use cases.

2 Likes