title: Get Stock Price from Morningstar / BeautifulSoup
body: <p>so it's happening. Finally, I have to ask my first question on Stackoverflow.</p>
  
  <p>I'm trying to get the current price of a stock from Morningstar (<a href="https://www.morningstar.com/stocks/xnas/tsla/quote.html" rel="nofollow noreferrer">https://www.morningstar.com/stocks/xnas/tsla/quote.html</a>) and I am using Beautifulsoup for this.</p>
  
  <p>In the HTML code there is an unique ID ("message-box-price"). I want to use it to get the Price after it, but unfortunately I'm not able to find a solution. It would be nice if somebody can help me.</p>
  
  <p>My code to get the site is: </p>
  
  <pre><code>import bs4
  import requests
  
  res = requests.get('https://www.morningstar.com/stocks/xnas/tsla/quote.html')
  res.raise_for_status()
  soup = bs4.BeautifulSoup(res.text, 'lxml')
  </code></pre>
  
  <p>I have tried many different methods but I thought these were the most promising ones:</p>
  
  <p>Number 1:</p>
  
  <pre><code>price = soup.find(id='message-box-price')
  price2 = price.find_next()
  print(price2)
  </code></pre>
  
  <p>Number 2:    </p>
  
  <pre><code>price = soup.select("#message-box-price")
  price2 = price.find_all_next()
  print(price2)
  </code></pre>
  
  <p>Number 3:</p>
  
  <pre><code>price = soup.find_all(id="message-box-price")
  print(price)
  </code></pre>
  
  <p>Also I have tried some variations of it and used .text to get the values for example.</p>
  
  <p>Errors have been:</p>
  
  <ul>
  <li>AttributeError: 'NoneType' object has no attribute 'find_previous'</li>
  <li>AttributeError: 'list' object has no attribute 'text'</li>
  <li>TypeError: select() got an unexpected keyword argument 'attrs'</li>
  <li>Or I just got an empty list back -> [ ]</li>
  </ul>