title: Web scrape website with dropdown menu that changes website dynamically (onchange)
body: <p>So I'm trying to scrape census data from a website that changes dynamically when a county is selected from the drop down menu. It looks like this:</p>
  
  <pre><code>&lt;select id="cat_id_select_GEO" onchange="changeHeaderSelection('GEO');
  &lt;option value="0500000US01001" select="selected"&gt;Autaga County, Alabama&lt;/option&gt;
  &lt;select&gt;
  </code></pre>
  
  <p><a href="https://factfinder.census.gov/faces/tableservices/jsf/pages/productview.xhtml?src=bkmk" rel="nofollow noreferrer">a link</a></p>
  
  <p>So from the research i've done, it sounds like i need to make some sort of Get request? (selenium?) but I am completely lost on how to do this. I know how to get the data i want, once i've made the county selection. But I've never had to scrape something where the website changes dynamically (i.e. the url doesn't change)</p>
  
  <p>I understand that some may find this to be a simple question... but I've read numerous other similar questions and would greatly benefit from someone walking me through example, and/or directing me to a solid guide.</p>
  
  <p>this is what i've been messing around with so far. I can see it kinda works at selecting the values... but it spits out this error: Message: stale element reference: element is not attached to the page document
    (Session info: chrome=74.0.3729.169)</p>
  
  <pre><code>
      for index, row in StateURLs.iterrows():
          url = row['URL']
          state = row['STATE']
  
          driver = webdriver.Chrome(executable_path=r'C:\chromedriver.exe')
          driver.get(url)
          select_county = Select(driver.find_element_by_id('cat_id_select_GEO'))
          options = select_county.options
          for index in range(0, len(options) - 1):
              select_county.select_by_index(index)
  
  </code></pre>
  
  <p>I also would love help on how to then convert this webpages to beautiful soup so i can scrape each page after the selection is made</p>