title: How to get all elements from webpage using Selenium?
body: <p>My Python code is only finding the first article of the HTML, so it is printing the same link. How do I get all article tags from the HTML? Thanks.</p>
  
  <p>Python code: </p>
  
  <pre><code>links = driver.find_elements_by_tag_name("article")
  for i in links:
      if driver.find_element_by_xpath("//div[@class='inner-article']/a//div[@class='sold_out_tag']").get_attribute("innerHTML") == "sold out":
          print("sold out")
          link = ((driver.find_element_by_xpath("//div[@class='inner-article']/a").get_attribute("href")))
          print(link)
      else:
          print("available")
  time.sleep(5)
  driver.quit()
  </code></pre>
  
  <p>HTML: </p>
  
  <pre><code>&lt;article&gt;
     &lt;div class="inner-article"&gt;&lt;a style="height:81px;" 
     href="/shop/jackets/jly8dgwqu/w10m2pybx"&gt;&lt;img width="81" height="81" 
     src="//d17ol771963kd3.cloudfront.net/139432/vi/AHP1l8fMIcA.jpg" 
     alt="Ahp1l8fmica"&gt;&lt;div class="sold_out_tag"&gt;sold out&lt;/div&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;/article&gt;
  &lt;article&gt;
     &lt;div class="inner-article"&gt;&lt;a style="height:81px;" 
     href="/shop/jackets/jly8dgwqu/w10m2pybx"&gt;&lt;img width="81" height="81" 
     src="//d17ol771963kd3.cloudfront.net/139432/vi/AHP1l8fMIcA.jpg" 
     alt="Ahp1l8fmica"&gt;&lt;div class="sold_out_tag"&gt;sold out&lt;/div&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;/article&gt;
  </code></pre>