title: PhantomJS click a link on a page
body: <p>I have written some parts of a PhantomJS application. I am parsing on a website where I am writing username and password to a formular. After this I have to click on a link. Whereas I get this error:  </p>
  
  <pre><code>TypeError: 'undefined' is not a function (evaluating 'myLink.click()')
  
    phantomjs://webpage.evaluate():11
    phantomjs://webpage.evaluate():22
    phantomjs://webpage.evaluate():22
  </code></pre>
  
  <p>This is my PhantomJS code: </p>
  
  <pre><code>if(document.getElementById("m_Content_submitbtn2").getAttribute('data-role') == "button"){
          var myLink = document.getElementById("m_Content_submitbtn2");   
      myLink.click();
  }
  </code></pre>
  
  <p>And this is my link:</p>
  
  <pre><code>&lt;div class='button'&gt;&lt;a href="#" data-role="button" tabindex='0' onclick='WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&amp;quot;m$Content$submitbtn2&amp;quot;, &amp;quot;&amp;quot;, true, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, false, true)); return false;' id="m_Content_submitbtn2"&gt;Log ind&lt;/a&gt;&lt;/div&gt;&amp;nbsp;
  </code></pre>