title: Click on each onclick where the onclick attribute changes randomly
body: <p>I need to scrap a web and click on multiple tabs on the web.
  I'm checking the onclick's attribute value changes randomly and I can't find a way to select each tab. The onclick attribute are:
      onclick="clickDashboard('889113733777776')"
      onclick="clickDashboard('894967889413237')"</p>
  
  <p>This is the html fragment I want to try to click on each tab. I get it with getHTML() casprjs function, if I try to copy from source code (crtl+U) I just can see javascript code. You can also see how li tag class is 'activetab' to indicate which tab is displayed. <a href="https://drive.google.com/file/d/17inSduz_byO1TSqH2XOwvFwuGGTBpm-n/view?usp=sharing" rel="nofollow noreferrer">Here</a> link to full html source file</p>
  
  <pre><code>&lt;!--TEMPLATES--&gt;
      &lt;ul id="tabul"&gt;
          &lt;li id="litab" class="ntabs add"&gt;&lt;a href="" id="addtab" class="osx"&gt;+&lt;/a&gt;&lt;/li&gt;
          &lt;li id="litab" class="add rightAlign setting-item"&gt;
              &lt;img src="/Content/images/icons/expand-24x24.png" class="out-triggerer gray" onclick="fullScreen()"&gt;            
          &lt;/li&gt;        
          &lt;li id="default-report-export" class="rightAlign"&gt;
              &lt;a href="/report/defaultExport" download=""&gt;
                  &lt;input type="image" src="/Content/images/icons/excel.gif" value="Excel" title="Export default report"&gt;
              &lt;/a&gt;
          &lt;/li&gt;
          &lt;li id="default-report-export" class="rightAlign"&gt;
              &lt;a href="/report/defaultExport?isPdf=true" download=""&gt;
                  &lt;input type="image" src="/Content/images/export-pdf-24x24.png" value="Excel" title="Export default report"&gt;
              &lt;/a&gt;
          &lt;/li&gt;
          &lt;li id="dbTab_889113733777776" class="ntabs addedTab activeTab"&gt;
              &lt;span id="dbTabLabel_889113733777776" class="dashTitle" onclick="clickDashboard('889113733777776')"&gt;Dashboard EUR&lt;/span&gt;
              &lt;span id="dbTabSettings_889113733777776" class="settingsContainer dashSettings" style=""&gt;
                  &lt;div id="topnav" class="topnav"&gt;
                      &lt;a href="javascript:void(0)" class="signin" onclick="toggleTabSettingsMenu('889113733777776',true);"&gt;
                          &lt;span&gt;&lt;img src="/Content/Images/icon_gear.png" alt="Edit"&gt;&lt;/span&gt;
                      &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;fieldset id="dbTabSettingsMenu_889113733777776" class="dashSettings-menu"&gt;
                      &lt;ul class="dashboardEditMenu"&gt;
                          &lt;img src="/Content/images/close.png" onclick="toggleTabSettingsMenu('889113733777776',false);" alt="tooltip" style="position:absolute;right:2px;top:2px;border:0;"&gt;
                          &lt;li class="dashboardEditMenuList"&gt;
                              &lt;a href="javascript:void(0)" class="addWidget" onclick="toggleLeftUpdatePanelMenu(true);"&gt; Añadir widgets&lt;/a&gt;
                          &lt;/li&gt;
                          &lt;li class="dashboardEditMenuList"&gt;
                               &lt;a href="javascript:void(0)" class="closeDash" onclick="deleteDashboard('889113733777776')"&gt; Borrar este dashboard&lt;/a&gt;
                          &lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/fieldset&gt;
              &lt;/span&gt;
          &lt;/li&gt;
          &lt;li id="dbTab_894967889413237" class="ntabs addedTab"&gt;
              &lt;span id="dbTabLabel_894967889413237" class="dashTitle" onclick="clickDashboard('894967889413237')"&gt;Dashboard USD&lt;/span&gt;
              &lt;span id="dbTabSettings_894967889413237" class="settingsContainer dashSettings" style="display:none;"&gt;
                  &lt;div id="topnav" class="topnav"&gt;
                      &lt;a href="javascript:void(0)" class="signin" onclick="toggleTabSettingsMenu('894967889413237',true);"&gt;
                          &lt;span&gt;&lt;img src="/Content/Images/icon_gear.png" alt="Edit"&gt;&lt;/span&gt;
                      &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;fieldset id="dbTabSettingsMenu_894967889413237" class="dashSettings-menu"&gt; 
                      &lt;ul class="dashboardEditMenu"&gt;
                          &lt;img src="/Content/images/close.png" onclick="toggleTabSettingsMenu('894967889413237',false);" alt="tooltip" style="position:absolute;right:2px;top:2px;border:0;"&gt;
                          ...
                     &lt;/ul&gt;
              &lt;/fieldset&gt;
          &lt;/span&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I'm trying select each tab and make a screenshot with this code:</p>
  
  <pre><code>//Wait to be redirected to the Home page, and then make a screenshot
  casper.then(function(){
      casper.wait(5000, function(){
          this.capture('home.png');
          var tabs = document.querySelectorAll('[id^=dbTabLabel]');
          var i;
          console.log('Tabs found: ' + tabs.length);
          for(i = 0; i &lt; tabs.length; i++) {
              tabs.click()
              var name = 'tab' + i + '.png'
              this.capture(name); //Make a screenshot for each tab
          }
      })    
  });
  </code></pre>
  
  <p>But it seems that it doesn't select any tab because output is <code>Tabs found: 0</code></p>