title: Applescript to click link on webpage
body: <p>I'm trying to write an Applescript to automatically download account activity from a bank account. I've tried using the following:</p>
  
  <pre><code>tell application "Safari"
      do JavaScript "document.getElementsByClassName(\"lnkDownloadTransactions.lightbox-launcher\").click();" in window 1
  end tell
  </code></pre>
  
  <p>Where the HTML for the page is:</p>
  
  <pre><code>&lt;span class="download ui-flyout-activator ui-flyout-opened"&gt;
  
  &lt;a class="lnkDownloadTransactions lightbox-launcher" href="#" data-minwidth="600" data-height="590" data-lightbox=".lightbox-downloadtransactionsWidget" data-accountglobalid="X" data-laststatementdate="06/25/2014"&gt;
  
  &lt;span class="icon iconInbox"&gt;/span&gt;
  
  &lt;span class="text"&gt;Download Transactions/span&gt;
  
  &lt;/a&gt;
  
  &lt;input type="hidden" class="urlCtrlaccountsdownloadtransactionspartialview" value="/NFCU/accounts/downloadtransactionspartialview"&gt;
  
  &lt;section class="lightbox lightbox-downloadtransactionsWidget" style="position: static; display: none; width: auto; min-height: 0px; height: 496px;" title="Download Transactions"&gt;    section class="account-downloadtransactionsLightboxContent"&gt;  /section&gt;
  
  &lt;footer class="account-downloadtransactions-footer"&gt;
  
  &lt;div class="actionButtons submitFields"&gt;
  
  &lt;button type="button" class="cancelbutton cancel account-downloadtransactions-cancel-button" href="#"&gt;Cancel/button&gt;
  
  &lt;button class="button account-downloadtransactions-download-button"&gt;Download&lt;/button&gt;
          &lt;/div&gt;
      &lt;/footer&gt;/section&gt;/span&gt;
  </code></pre>
  
  <p>However it does not actually click on the link. Any recommendations?</p>