title: How to retrieve a Span Value by class name on a webpage in Python using beautiful soup?
body: <p>I am trying to access a price value by class name on a web page in python but I am running into some issues. First of all, the source code I see when I inspect the page directly from the page itself is different from the result I get in python after parsing the page as seen in my code below:</p>
  <pre><code>import requests
  from bs4 import BeautifulSoup
  
  # Make a request
  page = requests.get(
      &quot;https://www.takealot.com/hdmi-extender-lan-network-hdmi-extension-up-to-30m-cat5e-6/PLID90167662&quot;)
  soup = BeautifulSoup(page.content, 'html.parser')
  print(soup)
  
  </code></pre>
  <p>The result of soup is:</p>
  <pre><code>C:\Users\Netchoice\PycharmProjects\selenium\venv\Scripts\python.exe C:/Users/Netchoice/PycharmProjects/selenium/main.py
   &lt;!DOCTYPE html&gt;
  
  &lt;html dir=&quot;ltr&quot; lang=&quot;en&quot;&gt;
  &lt;head&gt;
  &lt;link as=&quot;script&quot; href=&quot;https://shopfront.takealot.com/static/js/app-loader.js&quot; rel=&quot;preload&quot;/&gt;
  &lt;link crossorigin=&quot;&quot; href=&quot;https://media.takealot.com&quot; rel=&quot;preconnect&quot;/&gt;
  &lt;title&gt;Takealot&lt;/title&gt;
  &lt;meta charset=&quot;utf-8&quot;/&gt;
  &lt;meta content=&quot;width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0&quot; name=&quot;viewport&quot;/&gt;
  &lt;meta content=&quot;ie=edge&quot; http-equiv=&quot;X-UA-Compatible&quot;/&gt;
  &lt;link href=&quot;data:image/x-icon;base64,AAABAAEAEBAAAAEACABoBQAAFgAAAC\
  gAAAAQAAAAIAAAAAEACAAAAAAAAAEA\
  AAAAAAAAAAAAAAEAAAAAAADWrHgA1a\
  p1AL16JgDmzLcAtnYSAP3//wD+//8A\
  t3YSAP///wDu1ssA+vDuAPXi2wDCgz\
  sAtnYRAP3//gD+//4AuHYRALd1EwD/\
  //4Au3okALl2EQC4dRMAuXUTALp1Ew\
  D///0At3USALh2EAC4dRIA//7/ALl2\
  EAC5dRIA69LDAP76+QDYsX4A2bF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  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
  AAAAAAAAGxsbGxsbJSsbLRUeGxsbGx\
  sbGxsbGxYCHyMBLBsbGxsbGxsbGxsT\
  GAgIHAobGxsbGxsbGxsbCwYICAYMGx\
  sbGxsbGxsbGyAcHAMHJhsbGxsbGxsb\
  GxsICAghFCUbGxsbGxsbGxsbCAgIIh\
  sbGxsbGxsbGxsbGwgICCIbGxsbGxsb\
  GxsbFhUIBiQpFiUbGxsbGxsbGxAICA\
  gGCBIEGxsbGxsbGxsRJAUICAYGJhsb\
  GxsbGxsbGSgSCA4JJxAbGxsbGxsbGx\
  sbCAgIABsbGxsbGxsbGxsbGwgICAAb\
  GxsbGxsbGxsbGxsGDwYqGxsbGxsbGx\
  sbGxsbGhcdDRsbGxsbGwAAAAAAAAAA\
  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
  AAAAAAAAAAAAAAA=&quot; rel=&quot;icon&quot; sizes=&quot;32x32&quot; type=&quot;image/x-icon&quot;&gt;
  &lt;link href=&quot;/favicon.ico&quot; rel=&quot;shortcut icon&quot; sizes=&quot;16x16&quot; type=&quot;image/x-icon&quot;/&gt;
  &lt;link href=&quot;/static/images/apple-touch-icon.png&quot; rel=&quot;apple-touch-icon&quot; sizes=&quot;180x180&quot; type=&quot;image/png&quot;/&gt;
  &lt;style&gt;
          html, body {
            background-color: #f4f4f4;
          }
          .sf {
            min-height: 400px;
          }
        &lt;/style&gt;
  &lt;/link&gt;&lt;/head&gt;
  &lt;body id=&quot;body&quot;&gt;
  &lt;div class=&quot;sf&quot; id=&quot;shopfront-app&quot;&gt;&lt;/div&gt;
  &lt;script onload=&quot;window.loadShopfront('https://shopfront.takealot.com');&quot; src=&quot;https://shopfront.takealot.com/static/js/app-loader.js&quot; type=&quot;text/javascript&quot;&gt;
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  
  Process finished with exit code 0
  </code></pre>
  <p>But When I inspect directly on the page I see everything (all the tags) including the one I am targeting which is as follows:</p>
  <pre><code>&lt;span class=&quot;currency plus currency-module_currency_29IIm&quot;&gt;R 137&lt;/span&gt;
  </code></pre>
  <p>That is just my first issue. Secondly I am failing to get the value &quot;R137&quot; in python. How can I retrieve this price value and store it in a variable called price based on my initial code?
  I would really appreciate it if somebody could help me with this.</p>
  <p>One more thing I needed to ask but on a different url. I needed to get other offers prices:</p>
  <pre><code>url2 = &quot;https://www.takealot.com/hdmi-extender-over-cat5e-6-network-ethernet-adapter/PLID42257092&quot;
  
  </code></pre>
  <p>How can I access the top price under the &quot;Other offers&quot; section as seen on the page and store it in &quot;other_offers_top&quot;?
  Finally How can I access the value of the following tag on the page:</p>
  <pre><code>&lt;span&gt;In stock&lt;/span&gt;
  
  </code></pre>