In [2]:
!pip install selenium


Downloading/unpacking selenium
  Downloading selenium-2.40.0.tar.gz (2.5MB): 2.5MB downloaded
  Running setup.py egg_info for package selenium
    
Installing collected packages: selenium
  Running setup.py install for selenium
    
Successfully installed selenium
Cleaning up...

In [3]:
import json
import os
import sys
from datetime import datetime

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
from selenium.webdriver.support import expected_conditions as EC # available since 2.26.0

In [4]:
sys.path.append(os.path.realpath(os.pardir))
sys.path


Out[4]:
['',
 '/home/blannon/.virtualenvs/lobbying/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
 '/home/blannon/.virtualenvs/lobbying/local/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg',
 '/home/blannon/.virtualenvs/lobbying/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
 '/home/blannon/.virtualenvs/lobbying/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg',
 '/home/blannon/.virtualenvs/lobbying/lib/python2.7',
 '/home/blannon/.virtualenvs/lobbying/lib/python2.7/plat-linux2',
 '/home/blannon/.virtualenvs/lobbying/lib/python2.7/lib-tk',
 '/home/blannon/.virtualenvs/lobbying/lib/python2.7/lib-old',
 '/home/blannon/.virtualenvs/lobbying/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/home/blannon/.virtualenvs/lobbying/local/lib/python2.7/site-packages',
 '/home/blannon/.virtualenvs/lobbying/lib/python2.7/site-packages',
 '/home/blannon/.virtualenvs/lobbying/local/lib/python2.7/site-packages/IPython/extensions',
 '/home/blannon/dev/lobbying-federal-domestic']

In [31]:
import re

import settings
from tasks.utils import mkdir_p

In [7]:
OUT_DIR = os.path.join(settings.CACHE_DIR,'house_clerk')

if not os.path.exists(OUT_DIR):
    mkdir_p(OUT_DIR)

In [8]:
def go_to_url(driver, url):
    driver.get(search_url)
    
def print_current_page(driver):
    with open('tmp_pg_source','w') as fout:
        fout.write(driver.page_source.encode('utf-8'))

Firefox profile for auto-downloading


In [91]:
fp = webdriver.FirefoxProfile()

fp.set_preference("browser.download.folderList",2)
fp.set_preference("browser.download.manager.showWhenStarting",False)
fp.set_preference("browser.download.dir", OUT_DIR)
fp.set_preference("browser.helperApps.neverAsk.saveToDisk", 
                  "application/x-octet-stream")

driver = webdriver.Firefox(firefox_profile=fp)

In [92]:
search_url = "http://disclosures.house.gov/ld/ldsearch.aspx"

In [93]:
begin_time = datetime.strftime(datetime.now(), '%Y%m%d_%H%M%S')

go_to_url(driver, search_url)

In [94]:
dl_button = driver.find_element_by_css_selector(
                'html body div#search_container div#downloadLink p a')

In [95]:
dl_button.click()

In [96]:
driver.switch_to_frame('TB_iframeContent')

In [98]:
filing_selector = driver.find_element_by_css_selector('select#selFilesXML')
for option in filing_selector.find_elements_by_tag_name('option'):
    print option.get_attribute("value")


2004 MidYear XML ( 12/27/2010 2:13:04 AM)
2004 Registrations XML ( 12/27/2010 2:22:48 AM)
2004 YearEnd XML ( 12/27/2010 2:21:54 AM)
2005 MidYear XML ( 12/25/2011 11:33:48 PM)
2005 Registrations XML ( 12/25/2011 11:39:10 PM)
2005 YearEnd XML ( 12/25/2011 11:38:03 PM)
2006 MidYear XML ( 12/30/2012 10:24:38 PM)
2006 Registrations XML ( 12/30/2012 10:28:41 PM)
2006 YearEnd XML ( 12/30/2012 10:27:52 PM)
2007 MidYear XML ( 12/29/2013 11:44:20 PM)
2007 Registrations XML ( 12/29/2013 11:59:20 PM)
2007 YearEnd XML ( 12/29/2013 11:56:24 PM)
2008 1stQuarter XML ( 3/16/2014 10:37:26 PM)
2008 2ndQuarter XML ( 3/16/2014 10:41:22 PM)
2008 3rdQuarter XML ( 3/16/2014 10:45:09 PM)
2008 4thQuarter XML ( 3/16/2014 10:49:10 PM)
2008 Registrations XML ( 3/16/2014 10:50:20 PM)
2009 1stQuarter XML ( 3/16/2014 10:19:18 PM)
2009 2ndQuarter XML ( 3/16/2014 10:23:07 PM)
2009 3rdQuarter XML ( 3/16/2014 10:26:44 PM)
2009 4thQuarter XML ( 3/16/2014 10:30:29 PM)
2009 Registrations XML ( 3/16/2014 10:32:04 PM)
2010 1stQuarter XML ( 3/16/2014 10:03:02 PM)
2010 2ndQuarter XML ( 3/16/2014 10:06:49 PM)
2010 3rdQuarter XML ( 3/16/2014 10:10:39 PM)
2010 4thQuarter XML ( 3/16/2014 10:14:15 PM)
2010 Registrations XML ( 3/16/2014 10:15:00 PM)
2011 1stQuarter XML ( 3/16/2014 9:47:27 PM)
2011 2ndQuarter XML ( 3/16/2014 9:51:03 PM)
2011 3rdQuarter XML ( 3/16/2014 9:54:28 PM)
2011 4thQuarter XML ( 3/16/2014 9:57:51 PM)
2011 Registrations XML ( 3/16/2014 9:58:33 PM)
2012 1stQuarter XML ( 3/16/2014 9:29:44 PM)
2012 2ndQuarter XML ( 3/16/2014 9:33:46 PM)
2012 3rdQuarter XML ( 3/16/2014 9:38:14 PM)
2012 4thQuarter XML ( 3/16/2014 9:41:55 PM)
2012 Registrations XML ( 3/16/2014 9:42:32 PM)
2013 1stQuarter XML ( 3/16/2014 9:14:24 PM)
2013 2ndQuarter XML ( 3/16/2014 9:18:49 PM)
2013 3rdQuarter XML ( 3/16/2014 9:23:10 PM)
2013 4thQuarter XML ( 3/19/2014 9:06:15 PM)
2013 Registrations XML ( 3/19/2014 9:06:52 PM)
2014 1stQuarter XML ( 3/16/2014 9:10:48 PM)
2014 Registrations XML ( 3/16/2014 9:10:54 PM)

In [99]:
year=r''
space=r'(\ )'
filing_type=r'(?P<filing_type>(?P<filing_type_year>\d{4})\ (?P<filing_type_form>MidYear|Registrations|YearEnd|(1st|2nd|3rd|4th)Quarter))'
space=r'(\ )'
xml = '(XML)'
space = r'(\ )'
date=r'(\(\ (?P<updated_date>(?P<updated_date_day>\d{1,2})\/(?P<updated_date_month>\d{2})\/(?P<updated_date_year>\d{4})))'
space=r'(\ )'
time=r'(?P<updated_time>(?P<updated_time_hour>\d{1,2}):(?P<updated_time_min>\d{2}):(?P<updated_time_sec>\d{2})\ (?P<updated_time_am_pm>PM|AM)\))'

option_rgx = re.compile(filing_type+space+xml+space+date+space+time)

In [100]:
options = [o for o in filing_selector.find_elements_by_tag_name('option')]

In [101]:
options[0]


Out[101]:
<selenium.webdriver.remote.webelement.WebElement at 0x3bd68d0>

In [102]:
options[0].get_attribute('value')


Out[102]:
u'2004 MidYear XML ( 12/27/2010 2:13:04 AM)'

In [103]:
test_set = zip(options, (re.match(option_rgx, o.get_attribute('value')) for o in options))

In [104]:
for source, result in test_set:
    print source.get_attribute('value')
    try:
        print json.dumps(result.groupdict(), indent=2)
    except Exception as e:
        print "ERROR:",e


2004 MidYear XML ( 12/27/2010 2:13:04 AM)
{
  "updated_date": "12/27/2010", 
  "updated_date_month": "27", 
  "updated_time_am_pm": "AM", 
  "filing_type": "2004 MidYear", 
  "filing_type_form": "MidYear", 
  "filing_type_year": "2004", 
  "updated_date_year": "2010", 
  "updated_time_hour": "2", 
  "updated_time_min": "13", 
  "updated_date_day": "12", 
  "updated_time": "2:13:04 AM)", 
  "updated_time_sec": "04"
}
2004 Registrations XML ( 12/27/2010 2:22:48 AM)
{
  "updated_date": "12/27/2010", 
  "updated_date_month": "27", 
  "updated_time_am_pm": "AM", 
  "filing_type": "2004 Registrations", 
  "filing_type_form": "Registrations", 
  "filing_type_year": "2004", 
  "updated_date_year": "2010", 
  "updated_time_hour": "2", 
  "updated_time_min": "22", 
  "updated_date_day": "12", 
  "updated_time": "2:22:48 AM)", 
  "updated_time_sec": "48"
}
2004 YearEnd XML ( 12/27/2010 2:21:54 AM)
{
  "updated_date": "12/27/2010", 
  "updated_date_month": "27", 
  "updated_time_am_pm": "AM", 
  "filing_type": "2004 YearEnd", 
  "filing_type_form": "YearEnd", 
  "filing_type_year": "2004", 
  "updated_date_year": "2010", 
  "updated_time_hour": "2", 
  "updated_time_min": "21", 
  "updated_date_day": "12", 
  "updated_time": "2:21:54 AM)", 
  "updated_time_sec": "54"
}
2005 MidYear XML ( 12/25/2011 11:33:48 PM)
{
  "updated_date": "12/25/2011", 
  "updated_date_month": "25", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2005 MidYear", 
  "filing_type_form": "MidYear", 
  "filing_type_year": "2005", 
  "updated_date_year": "2011", 
  "updated_time_hour": "11", 
  "updated_time_min": "33", 
  "updated_date_day": "12", 
  "updated_time": "11:33:48 PM)", 
  "updated_time_sec": "48"
}
2005 Registrations XML ( 12/25/2011 11:39:10 PM)
{
  "updated_date": "12/25/2011", 
  "updated_date_month": "25", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2005 Registrations", 
  "filing_type_form": "Registrations", 
  "filing_type_year": "2005", 
  "updated_date_year": "2011", 
  "updated_time_hour": "11", 
  "updated_time_min": "39", 
  "updated_date_day": "12", 
  "updated_time": "11:39:10 PM)", 
  "updated_time_sec": "10"
}
2005 YearEnd XML ( 12/25/2011 11:38:03 PM)
{
  "updated_date": "12/25/2011", 
  "updated_date_month": "25", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2005 YearEnd", 
  "filing_type_form": "YearEnd", 
  "filing_type_year": "2005", 
  "updated_date_year": "2011", 
  "updated_time_hour": "11", 
  "updated_time_min": "38", 
  "updated_date_day": "12", 
  "updated_time": "11:38:03 PM)", 
  "updated_time_sec": "03"
}
2006 MidYear XML ( 12/30/2012 10:24:38 PM)
{
  "updated_date": "12/30/2012", 
  "updated_date_month": "30", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2006 MidYear", 
  "filing_type_form": "MidYear", 
  "filing_type_year": "2006", 
  "updated_date_year": "2012", 
  "updated_time_hour": "10", 
  "updated_time_min": "24", 
  "updated_date_day": "12", 
  "updated_time": "10:24:38 PM)", 
  "updated_time_sec": "38"
}
2006 Registrations XML ( 12/30/2012 10:28:41 PM)
{
  "updated_date": "12/30/2012", 
  "updated_date_month": "30", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2006 Registrations", 
  "filing_type_form": "Registrations", 
  "filing_type_year": "2006", 
  "updated_date_year": "2012", 
  "updated_time_hour": "10", 
  "updated_time_min": "28", 
  "updated_date_day": "12", 
  "updated_time": "10:28:41 PM)", 
  "updated_time_sec": "41"
}
2006 YearEnd XML ( 12/30/2012 10:27:52 PM)
{
  "updated_date": "12/30/2012", 
  "updated_date_month": "30", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2006 YearEnd", 
  "filing_type_form": "YearEnd", 
  "filing_type_year": "2006", 
  "updated_date_year": "2012", 
  "updated_time_hour": "10", 
  "updated_time_min": "27", 
  "updated_date_day": "12", 
  "updated_time": "10:27:52 PM)", 
  "updated_time_sec": "52"
}
2007 MidYear XML ( 12/29/2013 11:44:20 PM)
{
  "updated_date": "12/29/2013", 
  "updated_date_month": "29", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2007 MidYear", 
  "filing_type_form": "MidYear", 
  "filing_type_year": "2007", 
  "updated_date_year": "2013", 
  "updated_time_hour": "11", 
  "updated_time_min": "44", 
  "updated_date_day": "12", 
  "updated_time": "11:44:20 PM)", 
  "updated_time_sec": "20"
}
2007 Registrations XML ( 12/29/2013 11:59:20 PM)
{
  "updated_date": "12/29/2013", 
  "updated_date_month": "29", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2007 Registrations", 
  "filing_type_form": "Registrations", 
  "filing_type_year": "2007", 
  "updated_date_year": "2013", 
  "updated_time_hour": "11", 
  "updated_time_min": "59", 
  "updated_date_day": "12", 
  "updated_time": "11:59:20 PM)", 
  "updated_time_sec": "20"
}
2007 YearEnd XML ( 12/29/2013 11:56:24 PM)
{
  "updated_date": "12/29/2013", 
  "updated_date_month": "29", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2007 YearEnd", 
  "filing_type_form": "YearEnd", 
  "filing_type_year": "2007", 
  "updated_date_year": "2013", 
  "updated_time_hour": "11", 
  "updated_time_min": "56", 
  "updated_date_day": "12", 
  "updated_time": "11:56:24 PM)", 
  "updated_time_sec": "24"
}
2008 1stQuarter XML ( 3/16/2014 10:37:26 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2008 1stQuarter", 
  "filing_type_form": "1stQuarter", 
  "filing_type_year": "2008", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "37", 
  "updated_date_day": "3", 
  "updated_time": "10:37:26 PM)", 
  "updated_time_sec": "26"
}
2008 2ndQuarter XML ( 3/16/2014 10:41:22 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2008 2ndQuarter", 
  "filing_type_form": "2ndQuarter", 
  "filing_type_year": "2008", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "41", 
  "updated_date_day": "3", 
  "updated_time": "10:41:22 PM)", 
  "updated_time_sec": "22"
}
2008 3rdQuarter XML ( 3/16/2014 10:45:09 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2008 3rdQuarter", 
  "filing_type_form": "3rdQuarter", 
  "filing_type_year": "2008", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "45", 
  "updated_date_day": "3", 
  "updated_time": "10:45:09 PM)", 
  "updated_time_sec": "09"
}
2008 4thQuarter XML ( 3/16/2014 10:49:10 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2008 4thQuarter", 
  "filing_type_form": "4thQuarter", 
  "filing_type_year": "2008", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "49", 
  "updated_date_day": "3", 
  "updated_time": "10:49:10 PM)", 
  "updated_time_sec": "10"
}
2008 Registrations XML ( 3/16/2014 10:50:20 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2008 Registrations", 
  "filing_type_form": "Registrations", 
  "filing_type_year": "2008", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "50", 
  "updated_date_day": "3", 
  "updated_time": "10:50:20 PM)", 
  "updated_time_sec": "20"
}
2009 1stQuarter XML ( 3/16/2014 10:19:18 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2009 1stQuarter", 
  "filing_type_form": "1stQuarter", 
  "filing_type_year": "2009", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "19", 
  "updated_date_day": "3", 
  "updated_time": "10:19:18 PM)", 
  "updated_time_sec": "18"
}
2009 2ndQuarter XML ( 3/16/2014 10:23:07 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2009 2ndQuarter", 
  "filing_type_form": "2ndQuarter", 
  "filing_type_year": "2009", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "23", 
  "updated_date_day": "3", 
  "updated_time": "10:23:07 PM)", 
  "updated_time_sec": "07"
}
2009 3rdQuarter XML ( 3/16/2014 10:26:44 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2009 3rdQuarter", 
  "filing_type_form": "3rdQuarter", 
  "filing_type_year": "2009", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "26", 
  "updated_date_day": "3", 
  "updated_time": "10:26:44 PM)", 
  "updated_time_sec": "44"
}
2009 4thQuarter XML ( 3/16/2014 10:30:29 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2009 4thQuarter", 
  "filing_type_form": "4thQuarter", 
  "filing_type_year": "2009", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "30", 
  "updated_date_day": "3", 
  "updated_time": "10:30:29 PM)", 
  "updated_time_sec": "29"
}
2009 Registrations XML ( 3/16/2014 10:32:04 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2009 Registrations", 
  "filing_type_form": "Registrations", 
  "filing_type_year": "2009", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "32", 
  "updated_date_day": "3", 
  "updated_time": "10:32:04 PM)", 
  "updated_time_sec": "04"
}
2010 1stQuarter XML ( 3/16/2014 10:03:02 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2010 1stQuarter", 
  "filing_type_form": "1stQuarter", 
  "filing_type_year": "2010", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "03", 
  "updated_date_day": "3", 
  "updated_time": "10:03:02 PM)", 
  "updated_time_sec": "02"
}
2010 2ndQuarter XML ( 3/16/2014 10:06:49 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2010 2ndQuarter", 
  "filing_type_form": "2ndQuarter", 
  "filing_type_year": "2010", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "06", 
  "updated_date_day": "3", 
  "updated_time": "10:06:49 PM)", 
  "updated_time_sec": "49"
}
2010 3rdQuarter XML ( 3/16/2014 10:10:39 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2010 3rdQuarter", 
  "filing_type_form": "3rdQuarter", 
  "filing_type_year": "2010", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "10", 
  "updated_date_day": "3", 
  "updated_time": "10:10:39 PM)", 
  "updated_time_sec": "39"
}
2010 4thQuarter XML ( 3/16/2014 10:14:15 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2010 4thQuarter", 
  "filing_type_form": "4thQuarter", 
  "filing_type_year": "2010", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "14", 
  "updated_date_day": "3", 
  "updated_time": "10:14:15 PM)", 
  "updated_time_sec": "15"
}
2010 Registrations XML ( 3/16/2014 10:15:00 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2010 Registrations", 
  "filing_type_form": "Registrations", 
  "filing_type_year": "2010", 
  "updated_date_year": "2014", 
  "updated_time_hour": "10", 
  "updated_time_min": "15", 
  "updated_date_day": "3", 
  "updated_time": "10:15:00 PM)", 
  "updated_time_sec": "00"
}
2011 1stQuarter XML ( 3/16/2014 9:47:27 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2011 1stQuarter", 
  "filing_type_form": "1stQuarter", 
  "filing_type_year": "2011", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "47", 
  "updated_date_day": "3", 
  "updated_time": "9:47:27 PM)", 
  "updated_time_sec": "27"
}
2011 2ndQuarter XML ( 3/16/2014 9:51:03 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2011 2ndQuarter", 
  "filing_type_form": "2ndQuarter", 
  "filing_type_year": "2011", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "51", 
  "updated_date_day": "3", 
  "updated_time": "9:51:03 PM)", 
  "updated_time_sec": "03"
}
2011 3rdQuarter XML ( 3/16/2014 9:54:28 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2011 3rdQuarter", 
  "filing_type_form": "3rdQuarter", 
  "filing_type_year": "2011", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "54", 
  "updated_date_day": "3", 
  "updated_time": "9:54:28 PM)", 
  "updated_time_sec": "28"
}
2011 4thQuarter XML ( 3/16/2014 9:57:51 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2011 4thQuarter", 
  "filing_type_form": "4thQuarter", 
  "filing_type_year": "2011", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "57", 
  "updated_date_day": "3", 
  "updated_time": "9:57:51 PM)", 
  "updated_time_sec": "51"
}
2011 Registrations XML ( 3/16/2014 9:58:33 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2011 Registrations", 
  "filing_type_form": "Registrations", 
  "filing_type_year": "2011", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "58", 
  "updated_date_day": "3", 
  "updated_time": "9:58:33 PM)", 
  "updated_time_sec": "33"
}
2012 1stQuarter XML ( 3/16/2014 9:29:44 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2012 1stQuarter", 
  "filing_type_form": "1stQuarter", 
  "filing_type_year": "2012", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "29", 
  "updated_date_day": "3", 
  "updated_time": "9:29:44 PM)", 
  "updated_time_sec": "44"
}
2012 2ndQuarter XML ( 3/16/2014 9:33:46 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2012 2ndQuarter", 
  "filing_type_form": "2ndQuarter", 
  "filing_type_year": "2012", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "33", 
  "updated_date_day": "3", 
  "updated_time": "9:33:46 PM)", 
  "updated_time_sec": "46"
}
2012 3rdQuarter XML ( 3/16/2014 9:38:14 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2012 3rdQuarter", 
  "filing_type_form": "3rdQuarter", 
  "filing_type_year": "2012", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "38", 
  "updated_date_day": "3", 
  "updated_time": "9:38:14 PM)", 
  "updated_time_sec": "14"
}
2012 4thQuarter XML ( 3/16/2014 9:41:55 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2012 4thQuarter", 
  "filing_type_form": "4thQuarter", 
  "filing_type_year": "2012", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "41", 
  "updated_date_day": "3", 
  "updated_time": "9:41:55 PM)", 
  "updated_time_sec": "55"
}
2012 Registrations XML ( 3/16/2014 9:42:32 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2012 Registrations", 
  "filing_type_form": "Registrations", 
  "filing_type_year": "2012", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "42", 
  "updated_date_day": "3", 
  "updated_time": "9:42:32 PM)", 
  "updated_time_sec": "32"
}
2013 1stQuarter XML ( 3/16/2014 9:14:24 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2013 1stQuarter", 
  "filing_type_form": "1stQuarter", 
  "filing_type_year": "2013", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "14", 
  "updated_date_day": "3", 
  "updated_time": "9:14:24 PM)", 
  "updated_time_sec": "24"
}
2013 2ndQuarter XML ( 3/16/2014 9:18:49 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2013 2ndQuarter", 
  "filing_type_form": "2ndQuarter", 
  "filing_type_year": "2013", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "18", 
  "updated_date_day": "3", 
  "updated_time": "9:18:49 PM)", 
  "updated_time_sec": "49"
}
2013 3rdQuarter XML ( 3/16/2014 9:23:10 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2013 3rdQuarter", 
  "filing_type_form": "3rdQuarter", 
  "filing_type_year": "2013", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "23", 
  "updated_date_day": "3", 
  "updated_time": "9:23:10 PM)", 
  "updated_time_sec": "10"
}
2013 4thQuarter XML ( 3/19/2014 9:06:15 PM)
{
  "updated_date": "3/19/2014", 
  "updated_date_month": "19", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2013 4thQuarter", 
  "filing_type_form": "4thQuarter", 
  "filing_type_year": "2013", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "06", 
  "updated_date_day": "3", 
  "updated_time": "9:06:15 PM)", 
  "updated_time_sec": "15"
}
2013 Registrations XML ( 3/19/2014 9:06:52 PM)
{
  "updated_date": "3/19/2014", 
  "updated_date_month": "19", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2013 Registrations", 
  "filing_type_form": "Registrations", 
  "filing_type_year": "2013", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "06", 
  "updated_date_day": "3", 
  "updated_time": "9:06:52 PM)", 
  "updated_time_sec": "52"
}
2014 1stQuarter XML ( 3/16/2014 9:10:48 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2014 1stQuarter", 
  "filing_type_form": "1stQuarter", 
  "filing_type_year": "2014", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "10", 
  "updated_date_day": "3", 
  "updated_time": "9:10:48 PM)", 
  "updated_time_sec": "48"
}
2014 Registrations XML ( 3/16/2014 9:10:54 PM)
{
  "updated_date": "3/16/2014", 
  "updated_date_month": "16", 
  "updated_time_am_pm": "PM", 
  "filing_type": "2014 Registrations", 
  "filing_type_form": "Registrations", 
  "filing_type_year": "2014", 
  "updated_date_year": "2014", 
  "updated_time_hour": "9", 
  "updated_time_min": "10", 
  "updated_date_day": "3", 
  "updated_time": "9:10:54 PM)", 
  "updated_time_sec": "54"
}

In [105]:
options_with_metadata = zip(options, (re.match(option_rgx, o.get_attribute('value')).groupdict() for o in options))

In [106]:
options_with_metadata


Out[106]:
[(<selenium.webdriver.remote.webelement.WebElement at 0x3bd68d0>,
  {'filing_type': u'2004 MidYear',
   'filing_type_form': u'MidYear',
   'filing_type_year': u'2004',
   'updated_date': u'12/27/2010',
   'updated_date_day': u'12',
   'updated_date_month': u'27',
   'updated_date_year': u'2010',
   'updated_time': u'2:13:04 AM)',
   'updated_time_am_pm': u'AM',
   'updated_time_hour': u'2',
   'updated_time_min': u'13',
   'updated_time_sec': u'04'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6e50>,
  {'filing_type': u'2004 Registrations',
   'filing_type_form': u'Registrations',
   'filing_type_year': u'2004',
   'updated_date': u'12/27/2010',
   'updated_date_day': u'12',
   'updated_date_month': u'27',
   'updated_date_year': u'2010',
   'updated_time': u'2:22:48 AM)',
   'updated_time_am_pm': u'AM',
   'updated_time_hour': u'2',
   'updated_time_min': u'22',
   'updated_time_sec': u'48'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6690>,
  {'filing_type': u'2004 YearEnd',
   'filing_type_form': u'YearEnd',
   'filing_type_year': u'2004',
   'updated_date': u'12/27/2010',
   'updated_date_day': u'12',
   'updated_date_month': u'27',
   'updated_date_year': u'2010',
   'updated_time': u'2:21:54 AM)',
   'updated_time_am_pm': u'AM',
   'updated_time_hour': u'2',
   'updated_time_min': u'21',
   'updated_time_sec': u'54'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd64d0>,
  {'filing_type': u'2005 MidYear',
   'filing_type_form': u'MidYear',
   'filing_type_year': u'2005',
   'updated_date': u'12/25/2011',
   'updated_date_day': u'12',
   'updated_date_month': u'25',
   'updated_date_year': u'2011',
   'updated_time': u'11:33:48 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'11',
   'updated_time_min': u'33',
   'updated_time_sec': u'48'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6950>,
  {'filing_type': u'2005 Registrations',
   'filing_type_form': u'Registrations',
   'filing_type_year': u'2005',
   'updated_date': u'12/25/2011',
   'updated_date_day': u'12',
   'updated_date_month': u'25',
   'updated_date_year': u'2011',
   'updated_time': u'11:39:10 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'11',
   'updated_time_min': u'39',
   'updated_time_sec': u'10'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd67d0>,
  {'filing_type': u'2005 YearEnd',
   'filing_type_form': u'YearEnd',
   'filing_type_year': u'2005',
   'updated_date': u'12/25/2011',
   'updated_date_day': u'12',
   'updated_date_month': u'25',
   'updated_date_year': u'2011',
   'updated_time': u'11:38:03 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'11',
   'updated_time_min': u'38',
   'updated_time_sec': u'03'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6810>,
  {'filing_type': u'2006 MidYear',
   'filing_type_form': u'MidYear',
   'filing_type_year': u'2006',
   'updated_date': u'12/30/2012',
   'updated_date_day': u'12',
   'updated_date_month': u'30',
   'updated_date_year': u'2012',
   'updated_time': u'10:24:38 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'24',
   'updated_time_sec': u'38'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6510>,
  {'filing_type': u'2006 Registrations',
   'filing_type_form': u'Registrations',
   'filing_type_year': u'2006',
   'updated_date': u'12/30/2012',
   'updated_date_day': u'12',
   'updated_date_month': u'30',
   'updated_date_year': u'2012',
   'updated_time': u'10:28:41 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'28',
   'updated_time_sec': u'41'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6990>,
  {'filing_type': u'2006 YearEnd',
   'filing_type_form': u'YearEnd',
   'filing_type_year': u'2006',
   'updated_date': u'12/30/2012',
   'updated_date_day': u'12',
   'updated_date_month': u'30',
   'updated_date_year': u'2012',
   'updated_time': u'10:27:52 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'27',
   'updated_time_sec': u'52'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd69d0>,
  {'filing_type': u'2007 MidYear',
   'filing_type_form': u'MidYear',
   'filing_type_year': u'2007',
   'updated_date': u'12/29/2013',
   'updated_date_day': u'12',
   'updated_date_month': u'29',
   'updated_date_year': u'2013',
   'updated_time': u'11:44:20 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'11',
   'updated_time_min': u'44',
   'updated_time_sec': u'20'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6850>,
  {'filing_type': u'2007 Registrations',
   'filing_type_form': u'Registrations',
   'filing_type_year': u'2007',
   'updated_date': u'12/29/2013',
   'updated_date_day': u'12',
   'updated_date_month': u'29',
   'updated_date_year': u'2013',
   'updated_time': u'11:59:20 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'11',
   'updated_time_min': u'59',
   'updated_time_sec': u'20'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6c10>,
  {'filing_type': u'2007 YearEnd',
   'filing_type_form': u'YearEnd',
   'filing_type_year': u'2007',
   'updated_date': u'12/29/2013',
   'updated_date_day': u'12',
   'updated_date_month': u'29',
   'updated_date_year': u'2013',
   'updated_time': u'11:56:24 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'11',
   'updated_time_min': u'56',
   'updated_time_sec': u'24'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6c90>,
  {'filing_type': u'2008 1stQuarter',
   'filing_type_form': u'1stQuarter',
   'filing_type_year': u'2008',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:37:26 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'37',
   'updated_time_sec': u'26'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6c50>,
  {'filing_type': u'2008 2ndQuarter',
   'filing_type_form': u'2ndQuarter',
   'filing_type_year': u'2008',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:41:22 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'41',
   'updated_time_sec': u'22'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6cd0>,
  {'filing_type': u'2008 3rdQuarter',
   'filing_type_form': u'3rdQuarter',
   'filing_type_year': u'2008',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:45:09 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'45',
   'updated_time_sec': u'09'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6550>,
  {'filing_type': u'2008 4thQuarter',
   'filing_type_form': u'4thQuarter',
   'filing_type_year': u'2008',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:49:10 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'49',
   'updated_time_sec': u'10'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6590>,
  {'filing_type': u'2008 Registrations',
   'filing_type_form': u'Registrations',
   'filing_type_year': u'2008',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:50:20 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'50',
   'updated_time_sec': u'20'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd65d0>,
  {'filing_type': u'2009 1stQuarter',
   'filing_type_form': u'1stQuarter',
   'filing_type_year': u'2009',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:19:18 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'19',
   'updated_time_sec': u'18'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6610>,
  {'filing_type': u'2009 2ndQuarter',
   'filing_type_form': u'2ndQuarter',
   'filing_type_year': u'2009',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:23:07 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'23',
   'updated_time_sec': u'07'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6b50>,
  {'filing_type': u'2009 3rdQuarter',
   'filing_type_form': u'3rdQuarter',
   'filing_type_year': u'2009',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:26:44 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'26',
   'updated_time_sec': u'44'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6a50>,
  {'filing_type': u'2009 4thQuarter',
   'filing_type_form': u'4thQuarter',
   'filing_type_year': u'2009',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:30:29 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'30',
   'updated_time_sec': u'29'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6bd0>,
  {'filing_type': u'2009 Registrations',
   'filing_type_form': u'Registrations',
   'filing_type_year': u'2009',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:32:04 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'32',
   'updated_time_sec': u'04'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6ed0>,
  {'filing_type': u'2010 1stQuarter',
   'filing_type_form': u'1stQuarter',
   'filing_type_year': u'2010',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:03:02 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'03',
   'updated_time_sec': u'02'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6f10>,
  {'filing_type': u'2010 2ndQuarter',
   'filing_type_form': u'2ndQuarter',
   'filing_type_year': u'2010',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:06:49 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'06',
   'updated_time_sec': u'49'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6f50>,
  {'filing_type': u'2010 3rdQuarter',
   'filing_type_form': u'3rdQuarter',
   'filing_type_year': u'2010',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:10:39 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'10',
   'updated_time_sec': u'39'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6f90>,
  {'filing_type': u'2010 4thQuarter',
   'filing_type_form': u'4thQuarter',
   'filing_type_year': u'2010',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:14:15 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'14',
   'updated_time_sec': u'15'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6fd0>,
  {'filing_type': u'2010 Registrations',
   'filing_type_form': u'Registrations',
   'filing_type_year': u'2010',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'10:15:00 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'10',
   'updated_time_min': u'15',
   'updated_time_sec': u'00'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6750>,
  {'filing_type': u'2011 1stQuarter',
   'filing_type_form': u'1stQuarter',
   'filing_type_year': u'2011',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:47:27 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'47',
   'updated_time_sec': u'27'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6790>,
  {'filing_type': u'2011 2ndQuarter',
   'filing_type_form': u'2ndQuarter',
   'filing_type_year': u'2011',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:51:03 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'51',
   'updated_time_sec': u'03'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6b10>,
  {'filing_type': u'2011 3rdQuarter',
   'filing_type_form': u'3rdQuarter',
   'filing_type_year': u'2011',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:54:28 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'54',
   'updated_time_sec': u'28'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6ad0>,
  {'filing_type': u'2011 4thQuarter',
   'filing_type_form': u'4thQuarter',
   'filing_type_year': u'2011',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:57:51 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'57',
   'updated_time_sec': u'51'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bd6d10>,
  {'filing_type': u'2011 Registrations',
   'filing_type_form': u'Registrations',
   'filing_type_year': u'2011',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:58:33 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'58',
   'updated_time_sec': u'33'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x39c31d0>,
  {'filing_type': u'2012 1stQuarter',
   'filing_type_form': u'1stQuarter',
   'filing_type_year': u'2012',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:29:44 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'29',
   'updated_time_sec': u'44'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bdd410>,
  {'filing_type': u'2012 2ndQuarter',
   'filing_type_form': u'2ndQuarter',
   'filing_type_year': u'2012',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:33:46 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'33',
   'updated_time_sec': u'46'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bdd050>,
  {'filing_type': u'2012 3rdQuarter',
   'filing_type_form': u'3rdQuarter',
   'filing_type_year': u'2012',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:38:14 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'38',
   'updated_time_sec': u'14'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bdd090>,
  {'filing_type': u'2012 4thQuarter',
   'filing_type_form': u'4thQuarter',
   'filing_type_year': u'2012',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:41:55 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'41',
   'updated_time_sec': u'55'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bdd110>,
  {'filing_type': u'2012 Registrations',
   'filing_type_form': u'Registrations',
   'filing_type_year': u'2012',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:42:32 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'42',
   'updated_time_sec': u'32'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bdd150>,
  {'filing_type': u'2013 1stQuarter',
   'filing_type_form': u'1stQuarter',
   'filing_type_year': u'2013',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:14:24 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'14',
   'updated_time_sec': u'24'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bdd190>,
  {'filing_type': u'2013 2ndQuarter',
   'filing_type_form': u'2ndQuarter',
   'filing_type_year': u'2013',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:18:49 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'18',
   'updated_time_sec': u'49'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bdd1d0>,
  {'filing_type': u'2013 3rdQuarter',
   'filing_type_form': u'3rdQuarter',
   'filing_type_year': u'2013',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:23:10 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'23',
   'updated_time_sec': u'10'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bdd210>,
  {'filing_type': u'2013 4thQuarter',
   'filing_type_form': u'4thQuarter',
   'filing_type_year': u'2013',
   'updated_date': u'3/19/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'19',
   'updated_date_year': u'2014',
   'updated_time': u'9:06:15 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'06',
   'updated_time_sec': u'15'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bdd250>,
  {'filing_type': u'2013 Registrations',
   'filing_type_form': u'Registrations',
   'filing_type_year': u'2013',
   'updated_date': u'3/19/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'19',
   'updated_date_year': u'2014',
   'updated_time': u'9:06:52 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'06',
   'updated_time_sec': u'52'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bdd290>,
  {'filing_type': u'2014 1stQuarter',
   'filing_type_form': u'1stQuarter',
   'filing_type_year': u'2014',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:10:48 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'10',
   'updated_time_sec': u'48'}),
 (<selenium.webdriver.remote.webelement.WebElement at 0x3bdd2d0>,
  {'filing_type': u'2014 Registrations',
   'filing_type_form': u'Registrations',
   'filing_type_year': u'2014',
   'updated_date': u'3/16/2014',
   'updated_date_day': u'3',
   'updated_date_month': u'16',
   'updated_date_year': u'2014',
   'updated_time': u'9:10:54 PM)',
   'updated_time_am_pm': u'PM',
   'updated_time_hour': u'9',
   'updated_time_min': u'10',
   'updated_time_sec': u'54'})]

In [107]:
option, metadata = options_with_metadata[3]

In [108]:
option.click()

In [109]:
driver.find_element_by_css_selector('#btnDownloadXML').click()

In [111]:
for option, metadata in options_with_metadata:
    option.click()
    driver.find_element_by_css_selector('#btnDownloadXML').click()

In [112]:
driver.close()

In [ ]: