<div dir="ltr"><div>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<br><br></div><div>someOper :: WD ()<br></div><div> ret <- executeJS [...] "...]<br></div> maybe (return ()) return ret -- parse value from executeJS as Maybe ()</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 11, 2015 at 11:48 AM, Denis Shevchenko <span dir="ltr"><<a href="mailto:haskell@dshevchenko.biz" target="_blank">haskell@dshevchenko.biz</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi there!<br>
<br>
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:<br>
<br>
<tt> ...</tt><tt><br>
</tt><tt> button <- findElement . ById $ "clearCart"</tt><tt><br>
</tt><tt> info <- elemInfo button</tt><tt><br>
</tt><tt> executeJS [JSArg info] "arguments[0].click();"</tt><tt><br>
</tt><tt> ...</tt><br>
<br>
But I got a runtime error:<br>
<br>
<tt>BadJSON "when expecting a (), encountered Null instead"</tt><br>
<br>
How can I fix it?<span class="HOEnZb"><font color="#888888"><br>
<br>
- Denis<br>
</font></span></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>