Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data WdOptions
- defaultWdOptions :: FilePath -> WdOptions
- runMode :: WdOptions -> RunMode
- seleniumToUse :: WdOptions -> SeleniumToUse
- chromeDriverToUse :: WdOptions -> ChromeDriverToUse
- geckoDriverToUse :: WdOptions -> GeckoDriverToUse
- capabilities :: WdOptions -> Capabilities
- httpManager :: WdOptions -> Maybe Manager
- httpRetryCount :: WdOptions -> Int
- saveSeleniumMessageHistory :: WdOptions -> WhenToSave
- data RunMode
- data XvfbConfig
- defaultXvfbConfig :: XvfbConfig
- xvfbResolution :: XvfbConfig -> Maybe (Int, Int)
- xvfbStartFluxbox :: XvfbConfig -> Bool
- data HeadlessConfig
- defaultHeadlessConfig :: HeadlessConfig
- headlessResolution :: HeadlessConfig -> Maybe (Int, Int)
- data SeleniumToUse
- data ChromeDriverToUse
- data GeckoDriverToUse
- data WhenToSave
- = Always
- | OnException
- | Never
- obtainSelenium :: (MonadIO m, MonadLogger m) => FilePath -> SeleniumToUse -> m (Either Text FilePath)
- obtainChromeDriver :: (MonadIO m, MonadLogger m, MonadBaseControl IO m) => FilePath -> ChromeDriverToUse -> m (Either Text FilePath)
- obtainGeckoDriver :: (MonadIO m, MonadLogger m, MonadBaseControl IO m) => FilePath -> GeckoDriverToUse -> m (Either Text FilePath)
- chromeCapabilities :: Capabilities
- headlessChromeCapabilities :: Capabilities
- firefoxCapabilities :: Capabilities
- headlessFirefoxCapabilities :: Capabilities
Main options
defaultWdOptions :: FilePath -> WdOptions Source #
The default WdOptions
object.
You should start with this and modify it using the accessors.
runMode :: WdOptions -> RunMode Source #
How to handle opening the browser (in a popup window, headless, etc.)
seleniumToUse :: WdOptions -> SeleniumToUse Source #
Which Selenium server JAR file to use
chromeDriverToUse :: WdOptions -> ChromeDriverToUse Source #
Which chromedriver executable to use
geckoDriverToUse :: WdOptions -> GeckoDriverToUse Source #
Which geckodriver executable to use
capabilities :: WdOptions -> Capabilities Source #
The WebDriver capabilities to use
httpManager :: WdOptions -> Maybe Manager Source #
HTTP manager for making requests to Selenium. If not provided, one will be created for each session.
httpRetryCount :: WdOptions -> Int Source #
Number of times to retry an HTTP request if it times out
saveSeleniumMessageHistory :: WdOptions -> WhenToSave Source #
When to save a record of Selenium requests and responses
Run mode constructors
Headless and Xvfb modes are useful because they allow you to run tests in the background, without popping up browser windows. This is useful for development or for running on a CI server, and is also more reproducible since the screen resolution can be fixed. In addition, Xvfb mode allows videos to be recorded of tests.
Normal | Normal Selenium behavior; will pop up a web browser. |
RunHeadless HeadlessConfig | Run with a headless browser. Supports screenshots but videos will be black. |
RunInXvfb XvfbConfig | Run inside Xvfb so that tests run in their own X11 display. xvfb-run script must be installed and on the PATH. |
Xvfb mode
data XvfbConfig Source #
xvfbResolution :: XvfbConfig -> Maybe (Int, Int) Source #
Resolution for the virtual screen. Defaults to (1920, 1080)
xvfbStartFluxbox :: XvfbConfig -> Bool Source #
Whether to start fluxbox window manager to go with the Xvfb session. fluxbox must be on the path
Headless mode
data HeadlessConfig Source #
headlessResolution :: HeadlessConfig -> Maybe (Int, Int) Source #
Resolution for the headless browser. Defaults to (1920, 1080)
Binary fetching options
data SeleniumToUse Source #
How to obtain the Selenium server JAR file.
DownloadSeleniumFrom String | Download selenium from the given URL to the |
DownloadSeleniumDefault | Download selenium from a default location to the |
UseSeleniumAt FilePath | Use the JAR file at the given path |
data ChromeDriverToUse Source #
How to obtain the chromedriver binary.
DownloadChromeDriverFrom String | Download chromedriver from the given URL to the |
DownloadChromeDriverVersion ChromeDriverVersion | Download the given chromedriver version to the |
DownloadChromeDriverAutodetect | Autodetect chromedriver to use based on the Chrome version and download it to the |
UseChromeDriverAt FilePath | Use the chromedriver at the given path |
data GeckoDriverToUse Source #
How to obtain the geckodriver binary.
DownloadGeckoDriverFrom String | Download geckodriver from the given URL to the |
DownloadGeckoDriverVersion GeckoDriverVersion | Download the given geckodriver version to the |
DownloadGeckoDriverAutodetect | Autodetect geckodriver to use based on the Gecko version and download it to the |
UseGeckoDriverAt FilePath | Use the geckodriver at the given path |
Miscellaneous constructors
data WhenToSave Source #
Instances
Eq WhenToSave Source # | |
Defined in Test.Sandwich.WebDriver.Internal.Types (==) :: WhenToSave -> WhenToSave -> Bool # (/=) :: WhenToSave -> WhenToSave -> Bool # | |
Show WhenToSave Source # | |
Defined in Test.Sandwich.WebDriver.Internal.Types showsPrec :: Int -> WhenToSave -> ShowS # show :: WhenToSave -> String # showList :: [WhenToSave] -> ShowS # |
Manually obtaining binaries
obtainSelenium :: (MonadIO m, MonadLogger m) => FilePath -> SeleniumToUse -> m (Either Text FilePath) Source #
Manually obtain a Selenium server JAR file, according to the SeleniumToUse
policy,
storing it under the provided FilePath
if necessary and returning the exact path.
obtainChromeDriver :: (MonadIO m, MonadLogger m, MonadBaseControl IO m) => FilePath -> ChromeDriverToUse -> m (Either Text FilePath) Source #
Manually obtain a chromedriver binary, according to the ChromeDriverToUse
policy,
storing it under the provided FilePath
if necessary and returning the exact path.
obtainGeckoDriver :: (MonadIO m, MonadLogger m, MonadBaseControl IO m) => FilePath -> GeckoDriverToUse -> m (Either Text FilePath) Source #
Manually obtain a geckodriver binary, according to the GeckoDriverToUse
policy,
storing it under the provided FilePath
if necessary and returning the exact path.
Browser capabilities
chromeCapabilities :: Capabilities Source #
Default capabilities for regular Chrome. Has the "browser" log level to ALL so that tests can collect browser logs.
headlessChromeCapabilities :: Capabilities Source #
Default capabilities for headless Chrome.
firefoxCapabilities :: Capabilities Source #
Default capabilities for regular Firefox.
headlessFirefoxCapabilities :: Capabilities Source #
Default capabilities for headless Firefox.