title: python - How to click "next" in Selenium until it's no longer available?
body: <p>I would like to scrape some data on a page and extract table from each page to a dataframe, then click on the "next" button and scrape some data on the second page until it's no longer available. How can I make it with this html structure:</p>
  
  <pre><code>&lt;div class="dataTables_paginate paging_bootstrap pagination"&gt;
   &lt;ul&gt;
    &lt;li class="active"&gt;&lt;a href="javascript:void(0);"&gt;First&lt;/a&gt;&lt;/li&gt;
    &lt;li class="active"&gt;&lt;a href="javascript:void(0);"&gt;Prev&lt;/a&gt;&lt;/li&gt;
    &lt;li p="1" class="active" onclick="loadDataByPage(1);"&gt;
     &lt;a href="javascript:void(0);" style="color:#0D88CB"&gt;1&lt;/a&gt;
    &lt;/li&gt;
    &lt;li p="2" class="inactive" onclick="loadDataByPage(2);"&gt;
     &lt;a href="javascript:void(0);"&gt;2&lt;/a&gt;
    &lt;/li&gt;
    &lt;li p="3" class="inactive" onclick="loadDataByPage(3);"&gt;
     &lt;a href="javascript:void(0);"&gt;3&lt;/a&gt;
    &lt;/li&gt;
    &lt;li p="2" class="inactive" onclick="loadDataByPage(2);"&gt;
     &lt;a href="javascript:void(0);" style="color:#0D88CB"&gt;Next&lt;/a&gt;
    &lt;/li&gt;
    &lt;li onclick="loadDataByPage(490);" class="inactive"&gt;
     &lt;a href="javascript:void(0);" style="color:#0D88CB"&gt;Last&lt;/a&gt;
    &lt;/li&gt;                
   &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>