title: Python scrape style display:none
body: <p>I want to scrape one webpage and I need to find <strong>if the style of the element</strong> is <em>display:none; or display:block</em>  as the following code . (If I see the source of the webpage I can't see any of this style. I know it because I use the Inspect element from Chrome)</p>
  
  <pre><code>&lt;p id="add_to_cart" class="buttons_bottom_block no-print" style="display: none;"&gt;
                                  &lt;button type="submit" name="Submit" class="exclusive"&gt;
                                      &lt;span&gt;¡Cómprame!&lt;/span&gt;
                                  &lt;/button&gt;
                              &lt;/p&gt;
  
  
                              &lt;p id="add_to_cart" class="buttons_bottom_block no-print" style="display: block;"&gt;
                                  &lt;button type="submit" name="Submit" class="exclusive"&gt;
                                      &lt;span&gt;¡Cómprame!&lt;/span&gt;
                                  &lt;/button&gt;
                              &lt;/p&gt;
  </code></pre>
  
  <p>It's about one Prestashop shop online
  Please look at the following video <a href="https://youtu.be/wlngNaNw1Ao" rel="nofollow">https://youtu.be/wlngNaNw1Ao</a>
  and you'll see the div oosHook change the style display:block or display:none but you can see this on the source code. Please check the link
  <a href="https://www.esenciadeperfume.com/bvlgari/bvlgari-man-in-black-edp.html#/6-formato-100_ml_tester" rel="nofollow">https://www.esenciadeperfume.com/bvlgari/bvlgari-man-in-black-edp.html#/6-formato-100_ml_tester</a></p>
  
  <p>and select one and other product you'll see the changes but if you analyze the source code it looks the same on all choices. I wrote the following python code for test and it can't detect the changes:</p>
  
  <pre><code> import urllib.request
  import re
  import pymysql
  from bs4 import BeautifulSoup
  
  #link1='https://www.esenciadeperfume.com/bvlgari/bvlgari-man-in-black-edp.html#/6-formato-100_ml_tester'
  link1='my reputation doesn't allow'
  req = urllib.request.Request(link1, headers={'User-Agent': 'Mozilla/5.0'})        
  htmltext = urllib.request.urlopen(req).read()
  if htmltext is None:
      print('erro')            
  else:
      matches=re.findall('&lt;div id="oosHook" style="display: block;"&gt;',str(htmltext))        
      if len(matches)==0:
          print('Not found')
      else:
          print('Found')
  </code></pre>
  
  <p>Ok It  seems with the following code I can do the job</p>
  
  <pre><code>import urllib.request
  import re
  import pymysql
  from bs4 import BeautifulSoup
  from selenium import webdriver
  link1='https://www.esenciadeperfume.com/bvlgari/bvlgari-man-in-black-edp.html#/6-formato-100_ml_tester'
  #link1='https://www.esenciadeperfume.com/bvlgari/bvlgari-man-in-black-edp.html#/20-formato-60_ml'
  browser = webdriver.Firefox()  # Your browser will open, Python might ask for permission
  browser.get(link1)               # This might take a while
  soup = BeautifulSoup(browser.page_source,'html.parser')
  cart_style = soup.find('p', id='add_to_cart').get('style')
  oos_style = soup.find('div', id='oosHook').get('style')
  print('Oos_style-&gt; '+oos_style)
  </code></pre>
  
  <p>The problem: <strong>The process it to slow</strong></p>