I have this problem all the time and it is pretty anoying. The problem is in parsing the return value. The javascript is returning null but the executeJS is returning `()`.  The aeson instance for `()` does not parse null.  What I do is something like

someOper :: WD ()
    ret <- executeJS [...] "...]
    maybe (return ()) return ret -- parse value from executeJS as Maybe ()

On Fri, Dec 11, 2015 at 11:48 AM, Denis Shevchenko <haskell@dshevchenko.biz> wrote:
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

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe