👤

Browser Profile

Warning: This feature is a work in progress and may be incomplete or subject to change. If you see an error or something that could be improved, please make a pull request. The link that documents this feature can be found at the bottom of the page.

Browser profiles allow you to load a custom browser profile during extension development, which can be useful for replicating real-user behavior, settings, extensions, and session data. You can either use the default profile provided by Extension.js or define your own path using the --profile flag in the CLI.

How Does It Work?

You can specify a custom browser profile to load during the browser launch process. Extension.js will hook into the browser's profile directory and load the specified profile, allowing you to test your extension in a real-world environment.

How to Use Browser Profiles

Using the Default Profile

By default, Extension.js launches a browser with a fresh, clean profile. This ensures there are no session conflicts or unwanted settings during testing.

Using a Custom Profile

To use a custom browser profile, you can specify the profile path in the extension.config.js file or use the --profile flag during the development process.

Example in extension.config.js:

module.exports = {
  browser: {
    chrome: {
      profile: "path/to/custom/profile",
    },
    firefox: {
      profile: "path/to/custom/firefox-profile",
    },
  },
};

CLI Option: Specifying a Custom Profile Path

You can also define a profile path directly in the CLI using the --profile flag:

extension dev --browser=chrome --profile=/path/to/custom/profile

In this case, the Chrome browser will launch with the specified profile from /path/to/custom/profile. This is useful for loading existing profiles with user-specific settings like extensions, bookmarks, or cookies.

Best Practices

  • Separate Profiles for Different Browsers: It's a good practice to maintain separate profiles for each browser to ensure clean, isolated testing environments.
  • Real-World Testing: Use real browser profiles from actual user sessions to test how your extension interacts with real-world data and settings.
  • Automated Testing: Define and automate the use of custom profiles to run tests in various user environments.

Next Steps