Beispiel #1
0
         moc['materia'] = tr.text.replace('Materia:','').strip()
     elif 'Iniciativa:' in tr.text:
         moc['iniciativa'] = tr.text.replace('Iniciativa:','').strip()
     elif 'Cámara de origen:' in tr.text:
         moc['origen'] = tr.text.replace('Cámara de origen:','').strip()
 
 # Hitos
 for tr in browser.find_elements_by_css_selector('table#ctl00_mainPlaceHolder_grvtramitacion tbody tr'):
     cols = tr.find_elements_by_tag_name('td')
     if len(cols) > 4: 
         hito = {
             "fecha": cols[0].text,
             "sesion": cols[1].text,
             "etapa": cols[2].text,
             "sub_etapa": cols[3].text,
             "documento_link": scraperhelper.getQueryParametersElementChild(cols[4])[0]
         }
     moc['hitos'].append(hito)
 
 # Informes
 browser.execute_script("__doPostBack('ctl00$mainPlaceHolder$btnInformes','')")
 WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.ID, 'ctl00_mainPlaceHolder_pnlInformes')))
 for tr in browser.find_elements_by_css_selector('table#ctl00_mainPlaceHolder_grvinformes tbody tr'):
    cols = tr.find_elements_by_tag_name('td')
    if len(cols) > 3: 
         informe = {
             "fecha": cols[0].text,
             "etapa": cols[1].text,
             "informe": cols[2].text,
             "documento_link": scraperhelper.getQueryParametersElementChild(cols[3])[0]
         }
        # Go to 'Ordenes del día'
        browser.get(
            'https://www.camara.cl/trabajamos/sesion_ordendia.aspx?prmid=' +
            session['prmid'])
        for el in browser.find_elements_by_css_selector('#detail .stress'):
            table = el.find_elements_by_tag_name('td')
            if (len(table) > 0):
                boletin = {
                    "boletin":
                    el.find_element_by_tag_name('h2').text.replace(
                        'Boletín ', ''),
                    "proyecto":
                    table[0].text.replace('ver detalle', ''),
                    "pley_prmid":
                    scraperhelper.getQueryParametersElementChild(table[0])[0],
                    "origen":
                    table[1].text,
                    "reglamentaria":
                    table[2].text,
                    "informantes":
                    table[3].text,
                    "informes": []
                }

                infs = table[4].find_elements_by_css_selector('tbody tr')
                for tr in infs:
                    cols = tr.find_elements_by_tag_name('td')
                    if (len(cols) > 0):
                        inf = {
                            "fecha":
Beispiel #3
0
                '#main table.tabla tbody tr'):
            cols = tr.find_elements_by_tag_name('td')
            if len(cols) > 5:
                res = {
                    "ingreso":
                    cols[0].text,
                    "numero":
                    cols[1].text,
                    "titulo":
                    cols[2].text,
                    "estado":
                    cols[3].text,
                    "documento_link":
                    scraperhelper.getLinkFromElementChild(cols[4]),
                    "prmid":
                    scraperhelper.getQueryParametersElementChild(cols[5])[0]
                }
                data.append(res)

        next_buttons = browser.find_elements_by_css_selector(
            '.pages ul li.next a')
        if len(next_buttons) > 0:
            page = page + 1
            browser.execute_script(
                next_buttons[0].get_attribute('href').replace(
                    'javascript:', ''))
            page_number = scraperhelper.waitForChangesInAttribute(
                browser, '.pages ul li.current', page_number, text=True)
            scraperhelper.pt('Loading Page ' + str(page))
        else:
            break