Reputation: 339
I'm new in Haskell (although I'm after reading LYAH). I have no idea what should I do to use selenium webdriver (webdriver link on hackage). I'm pretty sure that I should run one of these functions
runWD :: WDSession -> WD a -> IO aSource
runSession :: WDSession -> Capabilities -> WD a -> IO aSource
withSession :: WDSession -> WD a -> WD aSource
but i don't understand how to get this WD structure which is define as:
WD (StateT WDSession IO a)
Instances:
Monad WD
Functor WD
Applicative WD
MonadCatchIO WD
MonadIO WD
WebDriver WD
SessionState WD
MonadBase IO WD
MonadBaseControl IO WD
I wonder also what is the purpose of this WD structure?
Code example or indication of what I should have read about Haskell to understand what is going on here will be very helpful for me.
Upvotes: 3
Views: 941
Reputation: 34401
The reference page says that WD
is
A monadic interface to the WebDriver server. This monad is a simple, strict layer over IO, threading session information between sequential commands
So you can do something like this:
foo = runWD defaultSession $ do
liftIO $ putStrLn "Hello WD"
somethingElse
...
Upvotes: 2