Safe Haskell | None |
---|---|
Language | Haskell2010 |
Test.Sandwich.WebDriver.Config
Description
Configuration types for WebDriver servers, Xvfb mode, browser capabilities, etc.
Synopsis
- data WdOptions
- defaultWdOptions :: WdOptions
- runMode :: WdOptions -> RunMode
- capabilities :: WdOptions -> Capabilities
- httpManager :: WdOptions -> Maybe Manager
- httpRetryCount :: WdOptions -> Int
- saveSeleniumMessageHistory :: WdOptions -> WhenToSave
- getWdOptions :: WebDriver -> WdOptions
- getDisplayNumber :: WebDriver -> Maybe Int
- getDownloadDirectory :: WebDriver -> FilePath
- getWebDriverName :: WebDriver -> String
- getXvfbSession :: WebDriver -> Maybe XvfbSession
- data XvfbConfig
- defaultXvfbConfig :: XvfbConfig
- xvfbResolution :: XvfbConfig -> Maybe (Int, Int)
- xvfbStartFluxbox :: XvfbConfig -> Bool
- data HeadlessConfig
- defaultHeadlessConfig :: HeadlessConfig
- headlessResolution :: HeadlessConfig -> Maybe (Int, Int)
- chromeCapabilities :: Maybe FilePath -> Capabilities
- headlessChromeCapabilities :: Maybe FilePath -> Capabilities
- firefoxCapabilities :: Maybe FilePath -> Capabilities
- headlessFirefoxCapabilities :: Maybe FilePath -> Capabilities
- browserDependencies :: Label "browserDependencies" BrowserDependencies
- data BrowserDependenciesSpec
- data BrowserDependencies
- type HasBrowserDependencies context = HasLabel context "browserDependencies" BrowserDependencies
- data XvfbSession = XvfbSession {}
- data WhenToSave
- = Always
- | OnException
- | Never
- data RunMode
Main options
defaultWdOptions :: 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.).
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.
Accessors for the WebDriver
context
getDownloadDirectory :: WebDriver -> FilePath Source #
Get the configured download directory for the WebDriver
.
getWebDriverName :: WebDriver -> String Source #
getXvfbSession :: WebDriver -> Maybe XvfbSession Source #
Get the Xvfb session associated with the WebDriver
, if present.
Xvfb mode
data XvfbConfig Source #
defaultXvfbConfig :: XvfbConfig Source #
Default Xvfb settings.
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 #
Configuration for a headless browser.
defaultHeadlessConfig :: HeadlessConfig Source #
Default headless config.
headlessResolution :: HeadlessConfig -> Maybe (Int, Int) Source #
Resolution for the headless browser, specified as (width, height)
. Defaults to (1920, 1080)
.
Browser capabilities
chromeCapabilities :: Maybe FilePath -> Capabilities Source #
Default capabilities for regular Chrome. Has the "browser" log level to ALL so that tests can collect browser logs.
headlessChromeCapabilities :: Maybe FilePath -> Capabilities Source #
Default capabilities for headless Chrome.
firefoxCapabilities :: Maybe FilePath -> Capabilities Source #
Default capabilities for regular Firefox.
headlessFirefoxCapabilities :: Maybe FilePath -> Capabilities Source #
Default capabilities for headless Firefox.
Types
BrowserDependencies
browserDependencies :: Label "browserDependencies" BrowserDependencies Source #
data BrowserDependenciesSpec Source #
This type describes how to obain a browser + browser driver combination.
data BrowserDependencies Source #
Constructors
BrowserDependenciesChrome | |
BrowserDependenciesFirefox | |
Instances
Show BrowserDependencies Source # | |
Defined in Test.Sandwich.WebDriver.Internal.Dependencies Methods showsPrec :: Int -> BrowserDependencies -> ShowS # show :: BrowserDependencies -> String # showList :: [BrowserDependencies] -> ShowS # |
type HasBrowserDependencies context = HasLabel context "browserDependencies" BrowserDependencies Source #
Xvfb
data XvfbSession Source #
Constructors
XvfbSession | |
Fields |
Instances
Show XvfbSession Source # | |
Defined in Test.Sandwich.WebDriver.Internal.Types Methods showsPrec :: Int -> XvfbSession -> ShowS # show :: XvfbSession -> String # showList :: [XvfbSession] -> ShowS # |
Miscellaneous
data WhenToSave Source #
Constructors
Always | |
OnException | |
Never |
Instances
Show WhenToSave Source # | |
Defined in Test.Sandwich.WebDriver.Internal.Types Methods showsPrec :: Int -> WhenToSave -> ShowS # show :: WhenToSave -> String # showList :: [WhenToSave] -> ShowS # | |
Eq WhenToSave Source # | |
Defined in Test.Sandwich.WebDriver.Internal.Types |
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.
Constructors
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.
The |