2

I am writing a test on Selenium Webdriver. But the tricky part is, I need to send headers to the Chrome while working. Actually, I am adding a chrome extension to change the headers on runtime. But the most tricky part is that my test is running on Browserstack. Does my extension apply on browserstack too?

Helen Wt.
  • 81
  • 1
  • 4

1 Answers1

3

Yes, you can add extensions on BrowserStack Automate.

You need to upload the extension using ChromeOptions. But you need to have the .crx file on your local machine. You can refer to the below Python snippet and port it to the language of your choice. This would enable you to use the extensions on BrowserStack.

chrome_options = Options()
chrome_options.add_extension('/Users/ABCD/Downloads/Adblock-Plus_v1.12.4.crx')
desired_cap = chrome_options.to_capabilities()
kRixZ
  • 71
  • 2
  • Yes, it worked on Browserstack too. And adding the options into capabilities in Java as: ChromeOptions opts = new ChromeOptions(); opts.addExtensions(new File("idgpnmonknjnojddfkpgkljpfnnfcklj-2.2.5-Crx4Chrome.com.crx")); capabilities.setCapability(ChromeOptions.CAPABILITY, opts); Thank you. – Helen Wt. Dec 11 '18 at 23:02