title: SlimerJS Click a link/button
body: <p>I'm trying to click a button on a page using SlimerJS.</p>
  
  <p>On the SlimerJS documentation, I see <code>sendEvent(eventType, arg1, arg2, button, modifier)</code> which allows us to click on a given position by X and Y coordinates. <a href="http://docs.slimerjs.org/current/api/webpage.html#sendevent-eventtype-arg1-arg2-button-modifier" rel="nofollow">(Doc here)</a></p>
  
  <p>So, I tried getting these X and Y of a button coordinates the following way:</p>
  
  <pre><code>var webpage = require("webpage").create();
  function clickButton(button)
  {
      var rect = button.getBoundingClientRect();
      webpage.sendEvent('click',rect.left,rect.top,'left',0);
  }
  webpage.open(url).then(function(){
      var button = webpage.evaluate(function(){
          signInButton = document.querySelector("#signIn");
          return signInButton;
      });
      clickButton(button);
  });
  </code></pre>
  
  <p>This way, no error is thrown, but the button doesn't seem to get clicked.
  Is something wrong with this practice? Is there a better way? Is there a way to click a button or a link provided just it's ID or tag name?</p>