Skip to content
This repository has been archived by the owner on Jul 14, 2019. It is now read-only.

Latest commit

 

History

History
1718 lines (1202 loc) · 35.1 KB

Api.md

File metadata and controls

1718 lines (1202 loc) · 35.1 KB

Webdriver.Runner

Allows you to execute a list list of steps or a group of these steps and get a summary of each of the runs. This module acts as a test suite runner, but can be reused for any other purpose as it will just run each of the steps at a time and report back the status using a port and through the Summary type alias.

Types

type alias Model = 
  { options : Webdriver.Options , runs : Webdriver.Runner.Run , sessions : Dict.Dict String Webdriver.Process.Model , initTimes : Dict.Dict String Time.Time , startTimes : Dict.Dict String Time.Time , statuses : Dict.Dict String Webdriver.Runner.RunStatus , summaries : Dict.Dict String Webdriver.Runner.Summary , summary : Webdriver.Runner.Summary }

The model used for concurrently running multiple lists of steps


type Run
    = Run

A Run can be either a single list of Step to execute in the browser or a group of these lists. Groups can be nested arbitrarily.


type Msg
    = Msg
    | StartRun String
    | StartedRun String
    | StopRun String
    | DriverMsg String

The Messages this module can process


type alias Flags = 
  { filter : Maybe.Maybe String }

Custom options to be set to the runner, such as filtering tests by name:

- filter: A string to match against the run name. Only matching runs will execute.

type alias RunStatus = 
  { failed : Bool, total : Int, remaining : Int, nextStep : String }

Represents the current status of a single run.


type alias Summary = 
  { output : String , passed : Int , failed : Int , screenshots : List String }

Represents the final result of a single run or a group of runs.


type alias WebdriverRunner = 
  Platform.Program Webdriver.Runner.Flags Webdriver.Runner.Model Webdriver.Runner.Msg

Describes programs created by this module. To be used as the main function signature


Creating runs and groups of runs

In order to run a list of steps you need to give the a name. You can also group multiple of them inside groups.

describe : String -> Webdriver.Runner.SingleRun -> Webdriver.Runner.Run

Describes with a name a list of steps to be executed

describe "Login smoke test" [...]

group : String -> List Webdriver.Runner.Run -> Webdriver.Runner.Run

Groups a list Runs under the same name

group "All Smoke Tests"
    [ describe "Login Tests" [...]
    , describe "Signup Tests" [...]
    ]

Kicking it off

run : Webdriver.Options -> Webdriver.Runner.Run -> Webdriver.Runner.WebdriverRunner

Runs all the webdriver steps and displays the results



#Webdriver.Assert

Allows to run assertions on the current state of the browser session and page contents.

Assertions are automatically named out of the type of the operation to perform, but can also be given custom names.

Types

type alias Expectation = 
  Expect.Expectation

An expectation is either a pass or a fail, with a descriptive name of the fact that was asserted.


Cookies

cookie : String
    -> (String -> Webdriver.Assert.Expectation)
    -> Webdriver.Step.Step

Asserts the value of a cookie. If the cookie does not exists the assertion will automatically fail.

cookie "user" <| Expect.equal "jon snow"

cookieExists : String -> Webdriver.Step.Step

Asserts that a cookie exists.

cookieExists "user"

cookieNotExists : String -> Webdriver.Step.Step

Asserts that a cookie has not been set.

cookieNotExists "user"

Page properties

url : (String -> Webdriver.Assert.Expectation) -> Webdriver.Step.Step

Asserts the value of the current url.

url <| Expect.equal "https://google.com"

pageHTML : (String -> Webdriver.Assert.Expectation) -> Webdriver.Step.Step

Asserts the html source of the current page.

pageHTML <|
    String.contains "Saved successfully" >> Expect.true "Expected a success message"

title : (String -> Webdriver.Assert.Expectation) -> Webdriver.Step.Step

Asserts the title tag of the current page.

tile <| Expect.equal "This is the page title"

elementCount : String
    -> (Int -> Webdriver.Assert.Expectation)
    -> Webdriver.Step.Step

Assets the number of elements matching a selector

elementCount "#loginForm input" <| Expect.atLeast 2

Element properties

attribute : String
    -> String
    -> (String -> Webdriver.Assert.Expectation)
    -> Webdriver.Step.Step

Asserts the value of an attribute for a given element. Only one element may be matched by the selector. If the attribute is not present in the element, the assertion will automatically fail.

attribute "input.username" "autocomplete" <| Expect.equal "off"

css : String
    -> String
    -> (String -> Webdriver.Assert.Expectation)
    -> Webdriver.Step.Step

Asserts the value of a css property for a given element. Only one element may be matched by the selector. If the attribute is not present in the element, the assertion will automatically fail.

css "input.username" "color" <| Expect.equal "#000000"

elementHTML : String
    -> (String -> Webdriver.Assert.Expectation)
    -> Webdriver.Step.Step

Asserts the HTML of an element. Only one element may be matched by the selector.

elementHTML "#username" <| Expect.equal "<input id='username' value='jon' />"

elementText : String
    -> (String -> Webdriver.Assert.Expectation)
    -> Webdriver.Step.Step

Asserts the text node of an element. Only one element may be matched by the selector.

elementText "p.intro" <| Expect.equal "Welcome to the site!"

exists : String -> Webdriver.Step.Step

Asserts that an element exists in the page. Only one element may be matched by the selector.

exists "h1.logo"

Element Dimensions and Position

elementSize : String
    -> (( Int, Int ) -> Webdriver.Assert.Expectation)
    -> Webdriver.Step.Step

Asserts the size (width, height) of an element. Only one element may be matched by the selector.

elementSize ".logo" <| (fst >> Expect.equal 100)

elementPosition : String
    -> (( Int, Int ) -> Webdriver.Assert.Expectation)
    -> Webdriver.Step.Step

Asserts the position (x, y) of an element. Only one element may be matched by the selector.

elementPosition ".logo" <| (snd >> Expect.atLeast 330)

elementViewPosition : String
    -> (( Int, Int ) -> Webdriver.Assert.Expectation)
    -> Webdriver.Step.Step

Asserts the position (x, y) of an element relative to the viewport. Only one element may be matched by the selector.

elementViewPosition ".logo" <| (snd >> Expect.atLeast 330)

visible : String -> Webdriver.Step.Step

Asserts that an element to be visible anywhere in the page. Only one element may be matched by the selector.

enabled "#username"

visibleWithinViewport : String -> Webdriver.Step.Step

Asserts that an element to be visible within the viewport. Only one element may be matched by the selector.

enabled "#username"

Form Elements

inputValue : String
    -> (String -> Webdriver.Assert.Expectation)
    -> Webdriver.Step.Step

Asserts the value of an input element. Only one element may be matched by the selector.

inputValue "#username" <| Expect.equal "jon_snow"

inputEnabled : String -> Webdriver.Step.Step

Asserts that an element exists in the page. Only one element may be matched by the selector.

enabled "#username"

optionSelected : String -> Webdriver.Step.Step

Asserts that a select option is selected. Only one element may be matched by the selector.

optionSelected "[value=\"foo\"]"

Custom Assertions

task : String -> Task.Task Basics.Never Webdriver.Assert.Expectation -> Webdriver.Step.Step

Asserts the result of performing a Task

task "Check custom assertion" (Task.succeed "My value" `Expect.equal` "My Value")

driverCommand : String
    -> (Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error a)
    -> (a -> Webdriver.Assert.Expectation)
    -> Webdriver.Step.Step

Asserts the result of executing a LowLevel Webdriver task. This allows you to create custom sequences of tasks to be executed directly in the webdriver, maybe after getting values from other tasks.

driverCommand "Custom cookie check"
    (Wd.getCookie "user")
    (Maybe.map (Expect.equal "2") >> Maybe.withDefault (Expect.fail "Cookie is missing")

sequenceCommands : String
    -> List (Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error a)
    -> (List a -> Webdriver.Assert.Expectation)
    -> Webdriver.Step.Step

Asserts the result of executing a list of LowLevel Webdriver task. This allows you to create custom sequences of tasks to be executed directly in the webdriver, maybe after getting values from other tasks.

driverCommand "Custom cookie check"
    [Wd.getCookie "user", Wd.getCookie "legacy_user"]
    (Maybe.oneOf >> Maybe.map (Expec.equal "2) >> Maybe.withDefault (Expect.fail "Cookie is missing"))


#Webdriver

A library to interface with Webdriver.io and produce commands to control a browser using selenium.

The functions exposed in this module are commands that produce no result back from the browser.

Basics

basicOptions : Webdriver.Options

Bare minimum options for running selenium


type alias Options = 
  Webdriver.LowLevel.Options

Driver options


type alias Step = 
  Webdriver.Step.Step

The valid actions that can be executed in the browser


stepName : Webdriver.Step -> String

Returns the human readable name of the step

stepName (click "a") === "Click on <a>"

withName : String -> Webdriver.Step -> Webdriver.Step

Gives a new human readable name to an existing step

click ".login"
    |> withName "Enter the private zone"

Simple Browser Control

visit : String -> Webdriver.Step

Visit a url


click : String -> Webdriver.Step

Click on an element using a selector


moveTo : String -> Webdriver.Step

Moves the mouse to the middle of the specified element


moveToWithOffset : String
    -> Int
    -> Int
    -> Webdriver.Step

Moves the mouse to the middle of the specified element. This function takes two integers (offsetX and offsetY).

If offsetX has a value, move relative to the top-left corner of the element on the X axis If offsetY has a value, move relative to the top-left corner of the element on the Y axis


close : Webdriver.Step

Close the current browser window


end : Webdriver.Step

Ends the browser session


switchToFrame : Int -> Webdriver.Step

Makes any future actions happen inside the frame specified by its index


Forms

setValue : String -> String -> Webdriver.Step

Fills in the specified input with the given value

setValue "#email" "foo@bar.com"

appendValue : String -> String -> Webdriver.Step

Appends the given string to the specified input's current value

setValue "#email" "foo"
addValue "#email" "@bar.com"

clearValue : String -> Webdriver.Step

Clears the value of the specified input field

clearValue "#email"

submitForm : String -> Webdriver.Step

Submits the form with the given selector


selectByIndex : String -> Int -> Webdriver.Step

Selects the option in the dropdown using the option index


selectByValue : String -> String -> Webdriver.Step

Selects the option in the dropdown using the option value


selectByText : String -> String -> Webdriver.Step

Selects the option in the dropdown using the option visible text


selectByAttribute : String
    -> String
    -> String
    -> Webdriver.Step

Selects the option in the dropdown using the value of the given attribute for the option node. For example, give the folowing HTML

<select id="mySelect">
    <option name="someName1">Text 1</option>
    <option name="someName2">Text 2</option>
</select>

The following code will match the first option:

selectByAttribute "#mySelect" "name" "someName1"

Waiting For Elements

waitForExist : String -> Int -> Webdriver.Step

Wait for an element (selected by css selector) for the provided amount of milliseconds to be present within the DOM


waitForNotExist : String -> Int -> Webdriver.Step

Wait for an element (selected by css selector) for the provided amount of milliseconds to be present absent from the DOM


waitForVisible : String -> Int -> Webdriver.Step

Wait for an element (selected by css selector) for the provided amount of milliseconds to be visible.


waitForNotVisible : String -> Int -> Webdriver.Step

Wait for an element (selected by css selector) for the provided amount of milliseconds to be invisible.


waitForText : String -> Int -> Webdriver.Step

Wait for an element (selected by css selector) for the provided amount of milliseconds to be have some text.


waitForNoText : String -> Int -> Webdriver.Step

Wait for an element (selected by css selector) for the provided amount of milliseconds to have no text.


pause : Int -> Webdriver.Step

Pauses the browser session for the given milliseconds


Waiting For Form Elements

waitForValue : String -> Int -> Webdriver.Step

Wait for an element (selected by css selector) for the provided amount of milliseconds to be have a value.


waitForNoValue : String -> Int -> Webdriver.Step

Wait for an element (selected by css selector) for the provided amount of milliseconds to have no value.


waitForSelected : String -> Int -> Webdriver.Step

Wait for an element (selected by css selector) for the provided amount of milliseconds to be selected.


waitForNotSelected : String -> Int -> Webdriver.Step

Wait for an element (selected by css selector) for the provided amount of milliseconds to not be selected.


waitForEnabled : String -> Int -> Webdriver.Step

Wait for an element (selected by css selector) for the provided amount of milliseconds to be enabled.


waitForNotEnabled : String -> Int -> Webdriver.Step

Wait for an element (selected by css selector) for the provided amount of milliseconds to be disabled.


Debugging

waitForDebug : Webdriver.Step

Stops the running queue and gives you time to jump into the browser and check the state of your application (e.g. using the dev tools). Once you are done go to the command line and press Enter.


Scrolling

scrollToElement : Webdriver.Selector -> Webdriver.Step

Scrolls the window to the element specified in the selector


scrollToElementOffset : Webdriver.Selector
    -> Int
    -> Int
    -> Webdriver.Step

Scrolls the window to the element specified in the selector and then scrolls the given amount of pixels as offset from such element


scrollWindow : Int -> Int -> Webdriver.Step

Scrolls the window to the absolute coordinate (x, y) position provided in pixels


Cookies

setCookie : String -> String -> Webdriver.Step

Set the value for a cookie


deleteCookie : String -> Webdriver.Step

Deletes a cookie by name


Screenshots

savePageScreenshot : String -> Webdriver.Step

Takes a screenshot of the whole page and saves it to a file


withScreenshot : Bool -> Webdriver.Step -> Webdriver.Step

Toggles the automatic screenshot capturing after executing the step. By default no screenshots are taken.

click ".login"
    |> withScreenshot True

Custom

triggerClick : String -> Webdriver.Step

Programatically trigger a click in the elements specified in the selector. This exists because some pages hijack in an odd way mouse click, and in order to test the behavior, it needs to be manually triggered.



#Webdriver.Branch

Enables you to conditionally execute a list of steps depending on the current state of the browser.

You can use this module to create logic branches and loops in the execution of your run.

Cookies

ifCookie : String
    -> (Maybe.Maybe String -> List Webdriver.Step.Step)
    -> Webdriver.Step.Step

Executes the list of steps the passed function returns depending on the value of the specified cookie


ifCookieExists : String -> List Webdriver.Step.Step -> Webdriver.Step.Step

Executes the provided list of steps if the specified cookie exists


ifCookieNotExists : String -> List Webdriver.Step.Step -> Webdriver.Step.Step

Executes the provided list of steps if the specified cookie does not exist


Page properties

ifUrl : (String -> List Webdriver.Step.Step) -> Webdriver.Step.Step

Executes the list of steps the passed function returns depending on the current url


ifPageHTML : (String -> List Webdriver.Step.Step) -> Webdriver.Step.Step

Executes the list of steps the passed function returns depending on the current page source


ifTitle : (String -> List Webdriver.Step.Step) -> Webdriver.Step.Step

Executes the list of steps the passed function returns depending on the current page title


ifElementCount : String
    -> (Int -> List Webdriver.Step.Step)
    -> Webdriver.Step.Step

Executes the list of steps the passed function returns depending on the number of elements returned by the selector


Element properties

ifAttribute : String
    -> String
    -> (Maybe.Maybe String -> List Webdriver.Step.Step)
    -> Webdriver.Step.Step

Executes the list of steps the passed function returns depending on the value of the specified attribute in the given element


ifCss : String
    -> String
    -> (Maybe.Maybe String -> List Webdriver.Step.Step)
    -> Webdriver.Step.Step

Executes the list of steps the passed function returns depending on the value of the specified css attribute in the given element


ifElementHTML : String
    -> (String -> List Webdriver.Step.Step)
    -> Webdriver.Step.Step

Executes the list of steps the passed function returns depending on the value of the HTMl for the given element


ifText : String
    -> (String -> List Webdriver.Step.Step)
    -> Webdriver.Step.Step

Executes the list of steps the passed function returns depending on the value of the text node of the given element


ifExists : String -> List Webdriver.Step.Step -> Webdriver.Step.Step

Executes the list of steps if the specified element exists in the DOM


ifNotExist : String -> List Webdriver.Step.Step -> Webdriver.Step.Step

Executes the list of steps if the specified element does not exist in the DOM


ifVisible : String -> List Webdriver.Step.Step -> Webdriver.Step.Step

Executes the list of steps if element is visible


ifNotVisible : String -> List Webdriver.Step.Step -> Webdriver.Step.Step

Executes the list of steps if element is not visible


Element Dimensions and Position

ifElementSize : String
    -> (( Int, Int ) -> List Webdriver.Step.Step)
    -> Webdriver.Step.Step

Executes the list of steps the passed function returns depending on the size (width, height) of the element


ifElementPosition : String
    -> (( Int, Int ) -> List Webdriver.Step.Step)
    -> Webdriver.Step.Step

Executes the list of steps the passed function returns depending on the location (x, y) of the element


ifElementViewPosition : String
    -> (( Int, Int ) -> List Webdriver.Step.Step)
    -> Webdriver.Step.Step

Executes the list of steps the passed function returns depending on the location (x, y) of the element relative to the current viewport


ifVisibleWithinViewport : String -> List Webdriver.Step.Step -> Webdriver.Step.Step

Executes the list of steps if the element is visible within the viewport


ifNotVisibleWithinViewport : String -> List Webdriver.Step.Step -> Webdriver.Step.Step

Executes the list of steps if the element is not visible within the viewport


Form Element Properties

ifValue : String
    -> (String -> List Webdriver.Step.Step)
    -> Webdriver.Step.Step

Executes the list of steps the passed function returns depending on the value of the specified input field


ifEnabled : String -> List Webdriver.Step.Step -> Webdriver.Step.Step

Executes the list of steps if the input element is enabled


ifNotEnabled : String -> List Webdriver.Step.Step -> Webdriver.Step.Step

Executes the list of steps if the input element is not enabled


ifOptionIsSelected : String -> List Webdriver.Step.Step -> Webdriver.Step.Step

Executes the list of steps if the option in the select box is selected


ifNotOptionIsSelected : String -> List Webdriver.Step.Step -> Webdriver.Step.Step

Executes the list of steps if the option in the select box is not selected


Custom branch logic

ifTask : Task.Task Basics.Never (List Webdriver.Step.Step) -> Webdriver.Step.Step

Executes the list of steps returned as the result of performing a Task


ifDriverCommand : (Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error a)
    -> (a -> List Webdriver.Step.Step)
    -> Webdriver.Step.Step

Executes the list of steps resulting of executing a LowLevel Webdriver task. This allows you to create custom sequences of tasks to be executed directly in the webdriver, maybe after getting values from other tasks.


ifSequenceCommands : String
    -> List (Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error a)
    -> (List a -> List Webdriver.Step.Step)
    -> Webdriver.Step.Step

Executes the list of steps that result of executing a list of LowLevel Webdriver task. This allows you to create custom sequences of tasks to be executed directly in the webdriver, maybe after getting values from other tasks.

ifSequenceCommands "Custom cookie check"
    [Wd.getCookie "user", Wd.getCookie "legacy_user"]
    (\ (c :: lc :: []) -> [ setValue "#someInput" c, setValue "#anotherInput" lc ] )


#Webdriver.LowLevel

Offers access to the webdriver.io js library

Types

type Error
    = Error
    | MissingElement Webdriver.LowLevel.ErrorDetails (Webdriver.LowLevel.WithSelector {})
    | UnreachableElement Webdriver.LowLevel.ErrorDetails (Webdriver.LowLevel.WithScreenshot (Webdriver.LowLevel.WithSelector {}))
    | TooManyElements Webdriver.LowLevel.ErrorDetails (Webdriver.LowLevel.WithSelector {})
    | FailedElementPrecondition Webdriver.LowLevel.ErrorDetails (Webdriver.LowLevel.WithSelector {})
    | UnknownError Webdriver.LowLevel.ErrorDetails (Webdriver.LowLevel.WithScreenshot {})
    | InvalidCommand Webdriver.LowLevel.ErrorDetails {}
    | Never 

Possible errors


type Browser
    = Browser

Represents a Browser Window


type alias Options = 
  { desiredCapabilities : Webdriver.LowLevel.Capabilities }

Options for selenium


type alias Capabilities = 
  { browserName : String }

Browser capabilities


Navigation

open : Webdriver.LowLevel.Options -> Task.Task Webdriver.LowLevel.Error ( String, Webdriver.LowLevel.Browser )

Opens a new browser window


url : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Visits the given url.


click : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Clicks the element after finding it with the given selector.


moveTo : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Moves the mouse to the middle of the specified element


moveToWithOffset : String
    -> Maybe.Maybe Int
    -> Maybe.Maybe Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Moves the mouse to the middle of the specified element. This function takes two integers (offsetX and offsetY).

If offsetX has a value, move relative to the top-left corner of the element on the X axis If offsetY has a value, move relative to the top-left corner of the element on the Y axis


close : Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Closes the current browser window


end : Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Ends the browser session


switchToFrame : Int -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Makes any future actions happen inside the frame specified by its index


Forms

selectByIndex : String
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Selects the option in the dropdown using the option index


selectByValue : String
    -> String
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Selects the option in the dropdown using the option value


selectByText : String
    -> String
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Selects the option in the dropdown using the option visible text


selectByAttribute : String
    -> String
    -> String
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Selects the option in the dropdown using the value of the given attribute for the option node.


setValue : String
    -> String
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Fills in the specified input with a value


appendValue : String
    -> String
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Appends to an input's value


clearValue : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Clears the value of the given input


submitForm : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Submits the form with the given selector


History

back : Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Goes back in the browser history


forward : Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Goes forward in the browser history


Waiting

waitForExist : String
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Wait for an element (selected by css selector) for the provided amount of milliseconds to be present within the DOM


waitForNotExist : String
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Wait for an element (selected by css selector) for the provided amount of milliseconds to be present absent from the DOM


waitForVisible : String
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Wait for an element (selected by css selector) for the provided amount of milliseconds to be visible.


waitForNotVisible : String
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Wait for an element (selected by css selector) for the provided amount of milliseconds to be invisible.


waitForValue : String
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Wait for an element (selected by css selector) for the provided amount of milliseconds to be have a value.


waitForNoValue : String
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Wait for an element (selected by css selector) for the provided amount of milliseconds to have no value.


waitForSelected : String
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Wait for an element (selected by css selector) for the provided amount of milliseconds to be selected.


waitForNotSelected : String
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Wait for an element (selected by css selector) for the provided amount of milliseconds to not be selected.


waitForText : String
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Wait for an element (selected by css selector) for the provided amount of milliseconds to be have some text.


waitForNoText : String
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Wait for an element (selected by css selector) for the provided amount of milliseconds to have no text.


waitForEnabled : String
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Wait for an element (selected by css selector) for the provided amount of milliseconds to be enabled.


waitForNotEnabled : String
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Wait for an element (selected by css selector) for the provided amount of milliseconds to be disabled.


pause : Int -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Pauses the browser session for the given milliseconds


Scrolling

scrollToElement : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Scrolls the window to the element specified in the selector


scrollToElementOffset : String
    -> Int
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Scrolls the window to the element specified in the selector and then scrolls the given amount of pixels as offset from such element


scrollWindow : Int
    -> Int
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Scrolls the window to the absolute coordinate (x, y) position provided in pixels


Screenshots

pageScreenshot : Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error String

Takes a screenshot of the whole page and returns a base64 encoded png


savePageScreenshot : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Takes a screenshot of the whole page and saves it to a file


viewportScreenshot : Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error String

Takes a screenshot of the current viewport and returns a base64 encoded png


Utilities

countElements : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error Int

Returns the count of elements matching the provided selector


triggerClick : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Programatically trigger a click in the elements specified in the selector. This exists because some pages hijack in an odd way mouse click, and in order to test the behavior, it needs to be manually triggered.


Debugging

debug : Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Stops the running queue and gives you time to jump into the browser and check the state of your application (e.g. using the dev tools). Once you are done go to the command line and press Enter.


Page properties

getUrl : Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error String

Returns the url for the current browser window


getPageHTML : Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error String

Returns the page HTML


getTitle : Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error String

Returns the current window title


Element properties

getAttribute : String
    -> String
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error (Maybe.Maybe String)

Returns the value for the given attribute in the specified element by selector


getCssProperty : String
    -> String
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error (Maybe.Maybe String)

Returns the value for the given attribute in the specified element by selector


getElementSize : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error { width : Int, height : Int }

Returns the size of the give element


getElementHTML : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error String

Returns the HTML for the given element


getElementPosition : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error { x : Int, y : Int }

Returns the element's location on a page


getElementViewPosition : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error { x : Int, y : Int }

Determine an element’s location on the screen once it has been scrolled into view.


getText : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error String

Returns the text node for the given element


getValue : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error String

Returns the input element's current value


elementExists : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error Bool

Returns true if the element exists in the DOM


elementVisible : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error Bool

Returns true if the input element is visible


elementVisibleWithinViewport : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error Bool

Returns true if the input element is visible


elementEnabled : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error Bool

Returns true if the input element is enabled


optionIsSelected : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error Bool

Returns true if the select option specified in the element selector is selected


Cokies

getCookie : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error (Maybe.Maybe String)

Returns the cookie value for the given cookie name


cookieExists : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error Bool

Returns true if the specified cookie is present


setCookie : String
    -> String
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error ()

Sets the value of a cookie


deleteCookie : String -> Webdriver.LowLevel.Browser -> Task.Task Webdriver.LowLevel.Error ()

Sets the value of a cookie


Custom

customCommand : String
    -> List Json.Encode.Value
    -> Webdriver.LowLevel.Browser
    -> Task.Task Webdriver.LowLevel.Error Json.Encode.Value

Allows you to execute an arbitrary command in the client by a name. The return value of the comand coms as a Json.Encode.Value.

customCommand "windowHandleSize" [JE.string "dc30381e-e2f3-9444-8bf3-12cc44e8372a"] browser