title: How to get attribute value Selenium + Python
body: <p>I'm working with Selenium in Python. I would like to get the value of an attribute ['href']  and check that it is different from '#', if yes<br>
  so click on the link if not out of the loop: </p>
  
  <pre><code>if not driver.find_element_by_link_text('»'):
          break
              # Open next page
      if driver.find_element_by_xpath("//a[.='»' and not(@href='#')]"):
          link=WebDriverWait(driver, 20).until(expected_conditions.element_to_be_clickable((By.LINK_TEXT, "»")))
          link.click()
      else:
          break 
  </code></pre>
  
  <p>Here is the source code of the web page:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;ul class="pagination"&gt;
  &lt;li class="disabled"&gt;&lt;a href="#"&gt;«&lt;/a&gt;&lt;/li&gt;
  &lt;li class="active"&gt;&lt;a class="" rel="nofollow" href="https://www.likibu.com/fr/search/39tuzgbpnycdv7tkj102g?guests=2&amp;amp;destination_id=4094&amp;amp;page=1"&gt;1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="" rel="nofollow" href="https://www.likibu.com/fr/search/39tuzgbpnycdv7tkj102g?guests=2&amp;amp;destination_id=4094&amp;amp;page=37"&gt;37&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a class="" rel="nofollow" href="https://www.likibu.com/fr/search/39tuzgbpnycdv7tkj102g?guests=2&amp;amp;destination_id=4094&amp;amp;page=2"&gt;»&lt;/a&gt;&lt;/li&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>My code does not work and I get this error:</p>
  
  <blockquote>
    <p>raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.NoSuchElementException</p>
  </blockquote>
  
  <p>Any help would be appreciated.</p>