title: How to pair an element's children by CSS selector using Selenium WebDriver in Python?
body: <p>I'm using Selenium WebDriver to scrape information from many web-pages. I wonder if it's possible to select multiple children elements by CSS selector. The HTML structure looks like:</p>
  
  <pre><code>&lt;section id="education"&gt;
    &lt;div class="degree"&gt;
      &lt;h3 class="school"&gt; School1 &lt;/h3&gt;
      &lt;p class="year"&gt; 2002-2008 &lt;/p&gt;
    &lt;/div&gt;
    &lt;div class="degree"&gt;
      &lt;h3 class="school"&gt; School2 &lt;/h3&gt;
    &lt;/div&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>In this case, I want to select the school names with their corresponding year ranges. But if I simply use:</p>
  
  <pre><code>driver.find_elements_by_css_selector('section[id="education"] div[class="school"]')
  driver.find_elements_by_css_selector('section[id="education"] p[class="year"]')
  </code></pre>
  
  <p>I will get two lists: <code>[School1, School2]</code> and <code>['2002-2008']</code>, and I won't be able to tell which school corresponds to year range <code>'2002-2008'</code>. So, is it possible to combine the corresponding school name and year range together? If there are other ways to get around it, it would be helpful too.</p>