sandwich-webdriver-0.3.0.0: Sandwich integration with Selenium WebDriver
Safe HaskellNone
LanguageHaskell2010

Test.Sandwich.WebDriver.Windows

Description

Functions for manipulating browser windows.

Synopsis

Window positioning

setWindowLeftSide :: (WebDriverMonad m context, MonadReader context m, WebDriver m) => m () Source #

Position the window on the left 50% of the screen.

setWindowRightSide :: (WebDriverMonad m context, MonadReader context m, WebDriver m) => m () Source #

Position the window on the right 50% of the screen.

setWindowFullScreen :: (WebDriverMonad m context, MonadReader context m, WebDriver m) => m () Source #

Fullscreen the browser window.

Screen resolution

getScreenResolution :: MonadIO m => WebDriver -> m (Int, Int, Int, Int) Source #

Get the screen resolution as (x, y, width, height). (The x and y coordinates may be nonzero in multi-monitor setups.) This function works with both normal RunMode and Xvfb mode.

Lower-level

getResolution Source #

Arguments

:: HasCallStack 
=> IO (Int, Int, Int, Int)

Returns (x, y, width, height)

Note: previously we got the screen resolution on Linux using the X11 Haskell library.

This was a troublesome dependency because it wouldn't build on Hackage, forcing us to upload the documentation manually.

It also caused problems when trying to make the demos easy to run on a clean machine or a Mac. So instead, we now implement platform-specific getResolution functions.

On Linux, the simplest way seems to be to parse the output of xrandr. This is the approach taken by at least one other library called screenres. The other way to do it would be to load the x11 and/or xinerama libraries like is done in screeninfo, but again, that would require users to install those libraries. Just using xrandr itself seems like an easier dependency.

getResolutionForDisplay Source #

Arguments

:: HasCallStack 
=> Int

Display number

-> IO (Int, Int, Int, Int)

Returns (x, y, width, height)

Get the resolution for a specific display.