Once upon a time, the main browser automation tool was Selenium. Users of
this package had to start a Selenium session themselves, making sure to
configure it with a browser-specific driver program like chromedriver or
geckodriver, and provide a hostname/port. Then, this package would connect to
Selenium and use its wire protocol to control browsers.
Nowadays, there is an official W3C spec (https://www.w3.org/TR/webdriver1)
specifying the protocol, and a number of implementations. Selenium still exists,
but Chromedriver and Geckodriver can both serve as standalone WebDriver servers.
This library now helps you start up a driver in one of these supported
configurations:
Selenium.jar with one or more supported sub-drivers (chromedriver,
geckodriver). This is similar to the traditional picture.
Chromedriver standalone.
Geckodriver standalone.
You can pick the configuration you want by passing a DriverConfig to the
startSession function. The WebDriver implementations have a few differences
between them, which this library tries to smooth over. For example, a single
Geckodriver instance can't start multiple Firefox sessions (see
https://github.com/mozilla/geckodriver/issues/1946). So, this library will spin
up a separate geckodriver process for every session.
For an example of using this package by itself, see Test.WebDriver.WD. For a
full test framework integrated with this package, see
sandwich-webdriver.
The WebDriverContext is an opaque type used by this library for
bookkeeping purposes. It tracks all the processes we spin up and all the
sessions we create.
Currently, we will create at most 1 Selenium or Chromedriver process per
WebDriverContext, and N Geckodriver processes, where N is the number of
Firefox sessions you request.
Close the given WebDriver session. This sends the DELETE
/session/:sessionId command to the WebDriver API, and then shuts down the
process if necessary.
For launching a WebDriver via "java -jar selenium.jar".
Selenium can launch other drivers on your behalf. You should pass these as driverConfigSubDrivers.
Close the given WebDriver session. This is a lower-level version of
closeSession, which manages the driver lifecycle for you. This version will
only issue the DELETE /session/:sessionId command to the driver, but will
not shut down driver processes.
A structure describing the capabilities of a session. This record
serves dual roles.
It's used to specify the desired capabilities for a session before
it's created. In this usage, fields that are set to Nothing indicate
that we have no preference for that capability.
When received from the server , it's used to describe the actual
capabilities given to us by the WebDriver server. Here a value of
Nothing indicates that the server doesn't support the capability.
Thus, for Maybe Bool fields, both Nothing and Just False indicate
a lack of support for the desired capability.
A class for monads that can handle wire protocol requests. This is the
operation underlying all of the high-level commands exported in
Test.WebDriver.Commands.
Instances2WebDriverBase
WebDriverBaseWDDefined in webdriver-0.15.0.0 · Test.WebDriver.WD
A command could not be completed because the element is in an invalid state, e.g. attempting to clear an element that isn't both editable and resettable.