title: getting an attribute from a tag with beautiful soup
body: <p>I am trying to get the attribute 'datetime'  but cant seem to do it right for the past couple of hours:</p>
  <pre><code>    driver.get(&quot;https://cointelegraph.com/tags/bitcoin&quot;)
      time.sleep(10)
     
      page_source = driver.page_source
      soup = BeautifulSoup(page_source, 'html.parser')
      #print(soup.prettify())
  
      articles = soup.find_all(&quot;article&quot;)
   
      for article in articles:
          print(&quot;--------------------------------&quot;)
          if article.has_attr('datetime'):
              print(article['datetime'])
     else:
          print('no attribute present')
  </code></pre>
  <p>I execute this and its seems that said attribute is not there:</p>
  <pre><code>--------------------------------
  no attribute present
  --------------------------------
  no attribute present
  --------------------------------
  no attribute present
  --------------------------------
  no attribute present
  --------------------------------
  no attribute present
  --------------------------------
  no attribute present
  --------------------------------
  </code></pre>
  <p>I checked the HTML and the 'datetime' attribute is there within the 'article' tag. But it looks like it only has one attribute which is 'class'.</p>
  <pre><code>&lt;article class=&quot;post-card-inline&quot; data-v-a5013924=&quot;&quot;&gt;
   &lt;a class=&quot;post-card-inline__figure-link&quot; href=&quot;/news/top-5-cryptocurrencies-to-watch-this-week-btc-xrp-link-bch-fil&quot;&gt;
    &lt;figure class=&quot;post-card-inline__figure&quot;&gt;
     &lt;div class=&quot;lazy-image post-card-inline__cover lazy-image_loaded&quot;&gt;
      &lt;span class=&quot;pending lazy-image__pending pending_dark pending_finished&quot;&gt;
       &lt;span class=&quot;pending__runner&quot;&gt;
       &lt;/span&gt;
      &lt;/span&gt;
      &lt;!-- --&gt;
      &lt;img alt=&quot;Top 5 cryptocurrencies to watch this week: BTC, XRP, LINK, BCH, FIL&quot; class=&quot;lazy-image__img&quot; pinger-seen=&quot;true&quot; src=&quot;https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDQvYWJlMzJhMjYtMmMwMi00ODczLTllNGUtYWQ2ZTdmMzEzOGNlLmpwZw==.jpg&quot; srcset=&quot;https://images.cointelegraph.com/images/370_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDQvYWJlMzJhMjYtMmMwMi00ODczLTllNGUtYWQ2ZTdmMzEzOGNlLmpwZw==.jpg
  1x, https://images.cointelegraph.com/images/740_aHR0cHM6Ly9zMy5jb2ludGVsZWdyYXBoLmNvbS91cGxvYWRzLzIwMjItMDQvYWJlMzJhMjYtMmMwMi00ODczLTllNGUtYWQ2ZTdmMzEzOGNlLmpwZw==.jpg 2x&quot;/&gt;
     &lt;/div&gt;
     &lt;span class=&quot;post-card-inline__badge post-card-inline__badge_default&quot;&gt;
      Price Analysis
     &lt;/span&gt;
    &lt;/figure&gt;
   &lt;/a&gt;
   &lt;div class=&quot;post-card-inline__content&quot;&gt;
    &lt;div class=&quot;post-card-inline__header&quot;&gt;
     &lt;a class=&quot;post-card-inline__title-link&quot; href=&quot;/news/top-5-cryptocurrencies-to-watch-this-week-btc-xrp-link-bch-fil&quot;&gt;
      &lt;span class=&quot;post-card-inline__title&quot;&gt;
       Top 5 cryptocurrencies to watch this week: BTC, XRP, LINK, BCH, FIL
      &lt;/span&gt;
     &lt;/a&gt;
     &lt;div class=&quot;post-card-inline__meta&quot;&gt;
      &lt;time class=&quot;post-card-inline__date&quot; datetime=&quot;2022-04-17&quot;&gt;
       4 hours ago
      &lt;/time&gt;
      &lt;p class=&quot;post-card-inline_
      ...
  </code></pre>