title: Python Selenium Loop Through Links
body: <p>Im new to python, or coding for that matter...</p>
  
  <p>This part of the code allows me to find all the elements that I want to click (click on the link open a new tab) </p>
  
  <pre><code>from selenium import webdriver
  import time
  
  driver = webdriver.Chrome()
  driver.get("http://www.rezultati.com/kosarka/filipini/kup/")
  
  list_of_links = driver.find_elements_by_css_selector(".cell_ad.time")
  for link in list_of_links:
      link.click()
  </code></pre>
  
  <p>Obviously this for loop only opens links..
  I'm interested in how to add, somethin like this, to collect some data:</p>
  
  <pre><code># wait to open link
  time.sleep(3) 
  # handle new window
  newtab = driver.current_window_handle
  driver.switch_to_window(newtab)
  # collecting data and print data
  date = driver.find_elements_by_class_name("mstat-date")
  for d in date:
      print(d.text)
  # Some code to close newtab?
  ????
  </code></pre>
  
  <p>How do I implement this throughout the for loop.. In other words want to go in every link and collect some data.. Whether it is possible? Some suggestions or examples code?   </p>