webdriver-0.0.1: a Haskell client for the Selenium WebDriver protocol

Safe HaskellNone




A module for working with Firefox profiles. Firefox profiles are manipulated in pure code and then "prepared" for network transmission.



data FirefoxProfile Source

A pure representation of a FirefoxProfile. This structure allows you to construct and manipulate Firefox profiles in pure code, deferring execution of IO operations until the profile is "prepared" using either prepareProfile or one of the wrapper functions prepareTempProfile and prepareLoadedProfile.




profileDir :: FilePath

Location of the profile in the file system

profileExts :: HashSet FilePath

A set of filepaths pointing to Firefox extensions. These paths can either refer to an .xpi file or an extension directory

profilePrefs :: HashMap Text FirefoxPref

A map of Firefox preferences. These are the settings found in the profile's prefs.js, and entries found in about:config

data PreparedFirefoxProfile Source

Represents a Firefox profile that has been prepared for network transmission. The profile cannot be modified in this form.


data FirefoxPref Source

A Firefox preference. This is the subset of JSON values that excludes arrays and objects.

addPref :: ToFirefox a => Text -> a -> FirefoxProfile -> FirefoxProfileSource

Add a new preference entry to a profile, overwriting any existing entry with the same key.

getPref :: Text -> FirefoxProfile -> Maybe FirefoxPrefSource

Retrieve a preference from a profile by key name.

deletePref :: Text -> FirefoxProfile -> FirefoxProfileSource

Delete an existing preference entry from a profile. This operation is silent if the preference wasn't found.


addExtension :: FilePath -> FirefoxProfile -> FirefoxProfileSource

Add a new extension to the profile. The file path should refer to an .xpi file or an extension directory. This operation has no effect if the same extension has already been added to this profile.

deleteExtension :: FilePath -> FirefoxProfile -> FirefoxProfileSource

Delete an existing extension from the profile. The file path should refer to an .xpi file or an extension directory. This operation has no effect if the extension was never added to the profile.

Loading and preparing profiles

loadProfile :: MonadIO m => FilePath -> m FirefoxProfileSource

Load an existing profile from the file system. Any prepared changes made to the FirefoxProfile will have no effect to the profile on disk.

prepareProfile :: MonadIO m => FirefoxProfile -> m PreparedFirefoxProfileSource

Prepare a FirefoxProfile for network transmission.

Internally, this function constructs a Firefox profile within a temp directory, archives it as a zip file, and then base64 encodes the zipped data. The temporary directory is deleted afterwards

prepareTempProfile :: MonadIO m => (FirefoxProfile -> FirefoxProfile) -> m PreparedFirefoxProfileSource

Apply a function on an automatically generated default profile, and prepare the result. The FirefoxProfile passed to the handler function is the same one used by sessions when no Firefox profile is specified

prepareLoadedProfile :: MonadIO m => FilePath -> (FirefoxProfile -> FirefoxProfile) -> m PreparedFirefoxProfileSource

Convenience function to load an existing Firefox profile from disk, apply a handler function, and then prepare the result for network transmission.