title: How do i iterate through a webelements list with Python and Selenium?
body: <p>I want to iterate through a webelements list and return the text from each of them but i only get the text from the first <code>&lt;h2&gt;</code>element and not from the rest elements that are inside the other <code>&lt;li&gt;</code> tags, and then the code exist that loop</p>
  <p>Here is part of the Html code from which i want to extract the text:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="KambiBC-event-page-component__column KambiBC-event-page-component__column--1"&gt;
    
              &lt;ul class="KambiBC-list-view__column"&gt;
                &lt;li class="KambiBC-bet-offer-category KambiBC-collapsible-container KambiBC-expanded KambiBC-bet-offer-category--hidden KambiBC-bet-offer-category--fade-in"&gt;
                  &lt;header class="KambiBC-bet-offer-category__header" data-touch-feedback="true"&gt;
                    &lt;h2 class="KambiBC-bet-offer-category__title js-bet-offer-category-title"&gt;Piete selectate&lt;/h2&gt;
                  &lt;/header&gt;
                &lt;/li&gt;
                &lt;li class="KambiBC-bet-offer-category KambiBC-collapsible-container KambiBC-expanded KambiBC-bet-offer-category--hidden KambiBC-bet-offer-category--fade-in"&gt;
                   &lt;header class="KambiBC-bet-offer-category__header" data-touch-feedback="true"&gt;
                    &lt;h2 class="KambiBC-bet-offer-category__title js-bet-offer-category-title"&gt;Another text&lt;/h2&gt;
                   &lt;/header&gt;
                &lt;/li&gt;
  
                &lt;li class="KambiBC-bet-offer-category KambiBC-collapsible-container KambiBC-bet-offer-category--hidden KambiBC-bet-offer-category--fade-in"&gt;
                   &lt;header class="KambiBC-bet-offer-category__header" data-touch-feedback="true"&gt;
                    &lt;h2 class="KambiBC-bet-offer-category__title js-bet-offer-category-title"&gt;Different text&lt;/h2&gt;
                   &lt;/header&gt;
               &lt;/li&gt;
                  
                &lt;li class="KambiBC-bet-offer-category KambiBC-collapsible-container KambiBC-bet-offer-category--hidden KambiBC-bet-offer-category--fade-in"&gt;
                   &lt;header class="KambiBC-bet-offer-category__header" data-touch-feedback="true"&gt;
                    &lt;h2 class="KambiBC-bet-offer-category__title js-bet-offer-category-title"&gt;Yet another text&lt;/h2&gt;
                   &lt;/header&gt;
                &lt;/li&gt;
                  
              &lt;/ul&gt;
                    
        
        &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>and this is the Python code:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>import time
  from selenium import webdriver
  from selenium.webdriver.common.by import By
  from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.support import expected_conditions as EC
  
  driver = webdriver.Edge("D:\pariuri\python\MicrosoftWebDriver.exe")
  driver.implicitly_wait(5)
  
  driver.get("https://www.unibet.ro/betting#filter/football")
  
  try:
      element_present = EC.presence_of_element_located((By.CLASS_NAME, 'KambiBC-event-result__score-list'))
      WebDriverWait(driver, 4).until(element_present)
  except TimeoutException:
      print ('Timed out waiting for page to load') 
  
  event = driver.find_elements_by_class_name('KambiBC-event-item KambiBC-event-item--type-match') 
  
  for items in event:
     link = items.find_element_by_class_name('KambiBC-event-item__link')
     scoruri =  items.find_element_by_class_name('KambiBC-event-item__score-container') 
     
     scor1 =  scoruri.find_element_by_xpath(".//li[@class='KambiBC-event-result__match']/span[1]")
     scor2 =  scoruri.find_element_by_xpath(".//li[@class='KambiBC-event-result__match']/span[2]")
     
     print (scor1.text)
     print (scor2.text)
     if scor1.text == '0' and scor2.text == '0':
         
  
          link.click()
          time.sleep(3)
  
  
          PlajePariuri = driver.find_elements_by_xpath("//ul[@class='KambiBC-list-view__column']")
          for items in PlajePariuri:
               NumePlaje = items.find_element_by_xpath("//li/header/h2")
               print (NumePlaje.text)
  
             
          
       </code></pre>
  </div>
  </div>
  </p>