Safe Haskell | None |
---|---|
Language | Haskell2010 |
Test.WebDriver.Profile
Description
A type for profile preferences. These preference values are used by both Firefox and Opera profiles.
Synopsis
- data Profile b = Profile {}
- data ProfilePref
- = PrefInteger !Integer
- | PrefDouble !Double
- | PrefString !Text
- | PrefBool !Bool
- class ToPref a where
- toPref :: a -> ProfilePref
- getPref :: Text -> Profile b -> Maybe ProfilePref
- addPref :: ToPref a => Text -> a -> Profile b -> Profile b
- deletePref :: Text -> Profile b -> Profile b
- hasExtension :: String -> Profile b -> Bool
- unionProfiles :: Profile b -> Profile b -> Profile b
- onProfileFiles :: Profile b -> (HashMap FilePath ByteString -> HashMap FilePath ByteString) -> Profile b
- onProfilePrefs :: Profile b -> (HashMap Text ProfilePref -> HashMap Text ProfilePref) -> Profile b
- newtype ProfileParseError = ProfileParseError String
- data Firefox
- defaultFirefoxProfile :: Profile Firefox
- loadFirefoxProfile :: MonadIO m => FilePath -> m (Profile Firefox)
- saveFirefoxProfile :: MonadIO m => Profile Firefox -> FilePath -> m ()
- firefoxProfileToArchive :: Profile Firefox -> Archive
Profiles and profile preferences
This structure allows you to construct and manipulate profiles. 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
|
data ProfilePref Source #
A profile preference value. This is the subset of JSON values that excludes arrays, objects, and null.
Constructors
PrefInteger !Integer | |
PrefDouble !Double | |
PrefString !Text | |
PrefBool !Bool |
Instances
FromJSON ProfilePref Source # | |
Defined in Test.WebDriver.Profile | |
ToJSON ProfilePref Source # | |
Defined in Test.WebDriver.Profile Methods toJSON :: ProfilePref -> Value # toEncoding :: ProfilePref -> Encoding # toJSONList :: [ProfilePref] -> Value # toEncodingList :: [ProfilePref] -> Encoding # omitField :: ProfilePref -> Bool # | |
Show ProfilePref Source # | |
Defined in Test.WebDriver.Profile Methods showsPrec :: Int -> ProfilePref -> ShowS # show :: ProfilePref -> String # showList :: [ProfilePref] -> ShowS # | |
Eq ProfilePref Source # | |
Defined in Test.WebDriver.Profile | |
ToPref ProfilePref Source # | |
Defined in Test.WebDriver.Profile Methods toPref :: ProfilePref -> ProfilePref Source # |
A typeclass to convert types to profile preference values
Methods
toPref :: a -> ProfilePref Source #
Instances
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
hasExtension :: String -> Profile b -> Bool Source #
Determines if a profile contains the given extension. specified as an .xpi file or directory name
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.
onProfileFiles :: Profile b -> (HashMap FilePath ByteString -> HashMap FilePath ByteString) -> Profile b Source #
Modifies the profileFiles
field of a profile
onProfilePrefs :: Profile b -> (HashMap Text ProfilePref -> HashMap Text ProfilePref) -> Profile b Source #
Modifies the profilePrefs
field of a profile.
Profile errors
newtype ProfileParseError Source #
An error occured while attempting to parse a profile's preference file.
Constructors
ProfileParseError String |
Instances
Exception ProfileParseError Source # | |
Defined in Test.WebDriver.Profile Methods toException :: ProfileParseError -> SomeException # fromException :: SomeException -> Maybe ProfileParseError # | |
Read ProfileParseError Source # | |
Defined in Test.WebDriver.Profile Methods readsPrec :: Int -> ReadS ProfileParseError # readList :: ReadS [ProfileParseError] # | |
Show ProfileParseError Source # | |
Defined in Test.WebDriver.Profile Methods showsPrec :: Int -> ProfileParseError -> ShowS # show :: ProfileParseError -> String # showList :: [ProfileParseError] -> ShowS # | |
Eq ProfileParseError Source # | |
Defined in Test.WebDriver.Profile Methods (==) :: ProfileParseError -> ProfileParseError -> Bool # (/=) :: ProfileParseError -> ProfileParseError -> Bool # |
Firefox
Phantom type used in the parameters of Profile
and PreparedProfile
defaultFirefoxProfile :: Profile Firefox Source #
Default Firefox Profile, used when no profile is supplied.
loadFirefoxProfile :: MonadIO m => FilePath -> m (Profile Firefox) Source #
Load an existing profile from the file system. Any prepared changes made to
the Profile
will have no effect to the profile on disk.
To make automated browser run smoothly, preferences found in
defaultFirefoxProfile
are automatically merged into the preferences of the on-disk
profile. The on-disk profile's preference will override those found in the
default profile.