Search code examples
seleniumselenium-chromedriversaucelabsgeckodriver

How to install browser extensions on saucelabs?


I want to install an browser extension before my tests starts. I read on the documentation here that I should create a prerun executable to do this for me. However I am not sure how to this. I have no experience with creating executables


Solution

  • Using the pre-run will only upload the extension onto the SauceLabs Virtual Machine, it won't install it onto the respective browser.

    If you want the extension to be installed on the browsers, you may want to consider setting a custom Firefox profile or Chrome options.

    Here is a simple Java Example for setting a firefox profile (make sure to use the full path otherwise you will likely get an error):

    FirefoxProfile profile = new FirefoxProfile();
    profile.addExtension(new File(<PATH TO EXTENSION>));
    caps.setCapability(FirefoxDriver.PROFILE, profile);