title: Casperjs how to get to next page
body: <p>I'm just beginning with casperjs and js trying to get it to navigate to a new page. </p>
  
  <p>There are multiple similar links on the page that look like this:</p>
  
  <pre><code>&lt;a href="#" onclick="GoToPage(1)"&gt;&lt;font class="IndexLink"&gt;2&lt;/font&gt;&lt;/a&gt;
  &lt;a href="#" onclick="GoToPage(2)"&gt;&lt;font class="IndexLink"&gt;2&lt;/font&gt;&lt;/a&gt;
  &lt;a href="#" onclick="GoToPage(3)"&gt;&lt;font class="IndexLink"&gt;2&lt;/font&gt;&lt;/a&gt;
  &lt;a href="#" onclick="GoToPage(4)"&gt;&lt;font class="IndexLink"&gt;2&lt;/font&gt;&lt;/a&gt;
  .etc.
  </code></pre>
  
  <p>I am on page 1 trying to go to page 2. Here is the partial code:</p>
  
  <pre><code>pageNumber=2;   // hard coded for now.
  var target = 'a[onclick="GoToPage('+ pageNumber + ')"]';
  this.test.assertSelectorExists(target);
  this.click(target);
  </code></pre>
  
  <p>I'm doing the test to assure myself that the selector is valid and the test passes. In the debug output I see that the url change is requested but it seems to go to the same page it is on instead of page 2.</p>
  
  <p>For what it's worth here is the debug output for this segment of code:</p>
  
  <p>PASS Found an element matching: a[onclick="GoToPage(2)"]
  [debug] [phantom] Mouse event 'click' on selector: a[onclick="GoToPage(2)"]
  [debug] [phantom] Navigation requested: url=<a href="http://www.clermontauditorrealestate.org/search/advancedsearch.aspx?mode=advanced#" rel="nofollow">http://www.clermontauditorrealestate.org/search/advancedsearch.aspx?mode=advanced#</a>, type=LinkClicked, lock=true, isMainFrame=true
  [debug] [phantom] url changed to "<a href="http://www.clermontauditorrealestate.org/search/advancedsearch.aspx?mode=advanced#" rel="nofollow">http://www.clermontauditorrealestate.org/search/advancedsearch.aspx?mode=advanced#</a>"
  [info] [phantom] Step 5/6: done in 2880ms.
  [info] [phantom] Step 6/6 <a href="http://www.clermontauditorrealestate.org/search/advancedsearch.aspx?mode=advanced#" rel="nofollow">http://www.clermontauditorrealestate.org/search/advancedsearch.aspx?mode=advanced#</a> (HTTP 200)
  [debug] [phantom] Capturing page to /Users/willirl/a-will-1-screenshot.png</p>
  
  <p>This is a public web site I'm scraping so I can post the full 20 or so lines of code if that would help.</p>
  
  <p>Any help is appreciated.</p>