[Haskell-cafe] webdriver and click via executeJS

Denis Shevchenko haskell at dshevchenko.biz
Fri Dec 11 17:48:09 UTC 2015


Hi there!

I use `webdriver` package for test automation with PhantomJS. And I need 
to click some button, but not with a `click` function, but with a native 
JS. I see a special function for such a task, `executeJS`, in the module 
`Test.WebDriver.Commands`. So this is my code:

     ...
     button <- findElement . ById $ "clearCart"
     info <- elemInfo button
     executeJS [JSArg info] "arguments[0].click();"
     ...

But I got a runtime error:

BadJSON "when expecting a (), encountered Null instead"

How can I fix it?

- Denis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20151211/651b8da9/attachment.html>


More information about the Haskell-Cafe mailing list