webdriver-0.12.0.1: a Haskell client for the Selenium WebDriver protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.WebDriver.Common.Profile

Description

A type for profile preferences. These preference values are used by both Firefox and Opera profiles.

Synopsis

Profiles and profile preferences

data Profile b Source #

This structure allows you to construct and manipulate profiles in pure code, deferring execution of IO operations until the profile is "prepared". This type is shared by both Firefox and Opera profiles; when a distinction must be made, the phantom type parameter is used to differentiate.

Constructors

Profile 

Fields

  • profileFiles :: HashMap FilePath FilePath

    A mapping from relative destination filepaths to source filepaths found on the filesystem. When the profile is prepared, these source filepaths will be moved to their destinations within the profile directory.

    Using the destination path as the key ensures that there is one unique source path going to each destination path.

  • profilePrefs :: HashMap Text ProfilePref

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

Instances

Instances details
Show (Profile b) Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

Methods

showsPrec :: Int -> Profile b -> ShowS #

show :: Profile b -> String #

showList :: [Profile b] -> ShowS #

Eq (Profile b) Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

Methods

(==) :: Profile b -> Profile b -> Bool #

(/=) :: Profile b -> Profile b -> Bool #

newtype PreparedProfile b Source #

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

data ProfilePref Source #

A profile preference value. This is the subset of JSON values that excludes arrays, objects, and null.

class ToPref a where Source #

A typeclass to convert types to profile preference values

Methods

toPref :: a -> ProfilePref Source #

Instances

Instances details
ToPref Int16 Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Int32 Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Int64 Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Int8 Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Word16 Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Word32 Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Word64 Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Word8 Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Text Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref ProfilePref Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref String Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Integer Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Bool Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Double Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Float Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Int Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

ToPref Word Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

Integral a => ToPref (Ratio a) Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

HasResolution r => ToPref (Fixed r) Source # 
Instance details

Defined in Test.WebDriver.Common.Profile

Preferences

getPref :: Text -> Profile b -> Maybe ProfilePref Source #

Retrieve a preference from a profile by key name.

addPref :: ToPref a => Text -> a -> Profile b -> Profile b Source #

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

deletePref :: Text -> Profile b -> Profile b Source #

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

Extensions

addExtension :: FilePath -> Profile b -> Profile b Source #

Add a new extension to the profile. The file path should refer to a .xpi file or an extension directory on the filesystem.

deleteExtension :: String -> Profile b -> Profile b Source #

Delete an existing extension from the profile. The string parameter should refer to an .xpi file or directory located within the extensions directory of the profile. This operation has no effect if the extension was never added to the profile.

hasExtension :: String -> Profile b -> Bool Source #

Determines if a profile contains the given extension. specified as an .xpi file or directory name

Other files and directories

addFile :: FilePath -> FilePath -> Profile b -> Profile b Source #

Add a file to the profile directory. The first argument is the source of the file on the local filesystem. The second argument is the destination as a path relative to a profile directory. Overwrites any file that previously pointed to the same destination

deleteFile :: FilePath -> Profile b -> Profile b Source #

Delete a file from the profile directory. The first argument is the name of file within the profile directory.

hasFile :: String -> Profile b -> Bool Source #

Determines if a profile contains the given file, specified as a path relative to the profile directory.

Miscellaneous profile operations

unionProfiles :: Profile b -> Profile b -> Profile b Source #

Takes the union of two profiles. This is the union of their HashMap fields.

onProfilePrefs :: Profile b -> (HashMap Text ProfilePref -> HashMap Text ProfilePref) -> Profile b Source #

Modifies the profilePrefs field of a profile.

Preparing profiles from disk

prepareLoadedProfile_ :: MonadBase IO m => FilePath -> m (PreparedProfile a) Source #

Efficiently load an existing profile from disk and prepare it for network transmission.

Preparing zipped profiles

prepareZippedProfile :: MonadBase IO m => FilePath -> m (PreparedProfile a) Source #

Prepare a zip file of a profile on disk for network transmission. This function is very efficient at loading large profiles from disk.

prepareZipArchive :: Archive -> PreparedProfile a Source #

Prepare a zip archive of a profile for network transmission.

prepareRawZip :: ByteString -> PreparedProfile a Source #

Prepare a ByteString of raw zip data for network transmission

Profile errors