Does testcafe support to load any crx extensions and also setup ModHeader extension with the custom header values in chrome browser

Viewed 209

Does testcafe support to load crx extensions in Chrome browser?

If so, please let me know what method needs to try out.

I tried below the code it doesn’t work out

await t.eval(new Function(fs.readFileSync('/foo.crx').toString()));

And also testcafe support to setup ModHeader extension with the custom header values.

1 Answers

Chrome extension file is an archive, which can contain not only .js files, but also .html, .css and any other file types. This means that it is not possible to install an extension via the t.eval function which executes JavaScript code.

If you only need to execute some js code from the extension, you can extract your crx file using the https://crxextractor.com/ service and call the eval function for the unpacked .js file.

As I understand, you want to use the ModHeader extension for intercepting HTTP requests, modify header values and so on. If so, please take a look at the built-in Request Hooks functionality which allows you to accomplish this task.

Related