table export to CSV after "javascript:__doPostBack"

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

table export to CSV after "javascript:__doPostBack"

by saki-saki on Mon Jul 18, 2016 7:35 pm

Hello!
First of all, I have to say I just started using imacros today so you can say Im really just a noob :roll: nevertheless I find imacros amazingly powerful. I would really like to learn more about it!
The problem I want to solve is this: I want to extract all the elements on the table that FOLLOWS after I click a link that is referenced as "javascript:_doPostBack". Each link "hosts" a table, so I need to loop this. If possible, to merge all the resulting tables into one without having to go trough a macro in VBA.
Code: Select all
VERSION BUILD=8970419 RECORDER=FX
SET !LOOP 1
SET !EXTRACT_TEST_POPUP NO
TAB T=1
URL GOTO=http://190.24.134.230/tierras/sentencias.aspx
TAG POS=1 TYPE=A ATTR=HREF:javascript:__doPostBack('ctl00$MainContent$GVSentencias','Select${{!LOOP}}')
TAG POS=1 TYPE=TABLE ATTR=* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=TEST.CSV

I'm unsure on how to get the table after the loop? I've tried with relative positioning (TAG POS=1) but it brings *EANF* which I assume is an error in the retrieval?
Any help would be highly appreciated. Im pretty sure this is a dumb question to ask...
saki-saki
 
Posts: 5
Joined: Mon Jul 18, 2016 6:14 pm

Re: table export to CSV after "javascript:__doPostBack"

by chivracq on Tue Jul 19, 2016 6:42 am

saki-saki wrote:Hello!
First of all, I have to say I just started using imacros today so you can say Im really just a noob :roll: nevertheless I find imacros amazingly powerful. I would really like to learn more about it!
The problem I want to solve is this: I want to extract all the elements on the table that FOLLOWS after I click a link that is referenced as "javascript:_doPostBack". Each link "hosts" a table, so I need to loop this. If possible, to merge all the resulting tables into one without having to go trough a macro in VBA.
Code: Select all
VERSION BUILD=8970419 RECORDER=FX
SET !LOOP 1
SET !EXTRACT_TEST_POPUP NO
TAB T=1
URL GOTO=http://190.24.134.230/tierras/sentencias.aspx
TAG POS=1 TYPE=A ATTR=HREF:javascript:__doPostBack('ctl00$MainContent$GVSentencias','Select${{!LOOP}}')
TAG POS=1 TYPE=TABLE ATTR=* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=TEST.CSV

I'm unsure on how to get the table after the loop? I've tried with relative positioning (TAG POS=1) but it brings *EANF* which I assume is an error in the retrieval?
Any help would be highly appreciated. Im pretty sure this is a dumb question to ask...

Welcome to the Forum...!

FCIM...! :mrgreen: (Always mention your FCI when you open a Thread, read my Sig, many Commands are not implemented for all Browsers/Versions...)
=> iMacros for FF v8.9.7, FF47...?, OS...? (Even if FF Version and OS shouldn't play a role in this Case I think, but I usually don't answer Threads when that Required Info is not mentioned...)

But OK, I had a look at your Script/Site, and hum..., I don't really understand what the Pb is, your Script works fine for me, it extracts all Tables fine on the Sub-Pages after clicking on each 'Seleccionar' Link.

If I loop your Script (well, "my" Script...!, I modified yours a little bit for Debug Purpose...) 3 times, it extracts the following 3 Tables:
Code: Select all
"""Reg."",""Radicacion"",""Clase"",""Nombre del Predio"",""Municipio/Vereda del predio"",""Fecha Providencia"",""Certificado"",""Descargar""
""1"",""
                        86001-31-21-001-2014-00564-00
                    "",""REST. DER. TERRITORIAL"","" "",""LA ESMERALDA (PUTUMAYO)VEREDA:LA ESMERALDA"",""Jul 14 2016 "",""2CC98898D222C05A 2A935F5C890DE9CE 8CE4CCC230A5A921 5E3D29DAF3724ED7"",""
                       
                    ""
""2"",""
                        86001-31-21-001-2014-00592-00
                    "",""REST. DER. TERRITORIAL"",""LOS ARRAYANES"",""EL PLACER (PUTUMAYO)VEREDA:EL PLACER"",""Jul  1 2016 "",""A432894B134BD58B D5ADB32AF10541EA 8E9FEA1AFD19F15F 03B9815AEDDABBDA"",""
                       
                    ""
""3"",""
                        86001-31-21-001-2013-00291-00
                    "",""REST. DER. TERRITORIAL"","" "",""EL PLACER (PUTUMAYO)VEREDA:"",""May 19 2016 "",""C7FFBAF1B7E13A4F 270EA9AE6104B1A4 7172CB7699A626CE D2F3CAEFF9885BB1"",""
                       
                    ""
""4"",""
                        86001-31-21-001-2013-00274-00
                    "",""REST. DER. TERRITORIAL"","" "",""EL PLACER (PUTUMAYO)VEREDA:"",""May 19 2016 "",""D0F4429C4C2A6706 0AF178CFA440A32E A76381FF5507FC91 54357F1067FE0DBB"",""
                       
                    ""
""5"",""
                        86001-31-21-001-2014-00148-00
                    "",""REST. DER. TERRITORIAL"",""LA ESPERANZA"",""KOFANIA (PUTUMAYO)VEREDA:SAN ISIDRO"",""May 18 2016 "",""A8E2A7B8DCA55AA2 88DB52868B27EC1C DD4F9F6A23743456 2F0CA1E28A9B7F98"",""
                       
                    ""
""6"",""
                        86001-31-21-001-2013-00321-00
                    "",""REST. DER. TERRITORIAL"",""VILLA NUEVA"",""EL PLACER (PUTUMAYO)VEREDA:"",""May  6 2016 "",""8784FD0AAD6399D1 EA3A337B2F4ABF68 E9DBF9B1A5185D80 DF833DADC5C6667E"",""
                       
                    ""
""7"",""
                        86001-31-21-001-2013-00326-00
                    "",""REST. DER. TERRITORIAL"","" "",""EL PLACER (PUTUMAYO)VEREDA:"",""May  6 2016 "",""F779AB58AFAAAC96 41E225D8F7BC8EAE AB960BFC0D612F47 2A341183B04B292E"",""
                       
                    ""
""8"",""
                        86001-31-21-001-2013-00072-00
                    "",""REST. DER. TERRITORIAL"",""LA DORADA"",""EL PLACER (PUTUMAYO)VEREDA:"",""May  5 2016 "",""673633DEFC25548E F456AF2D86BB1795 2A52C26C86C5E26F 359E987819A530E6"",""
                       
                    ""
""9"",""
                        86001-31-21-001-2013-00347-00
                    "",""REST. DER. TERRITORIAL"","" "",""EL PLACER (PUTUMAYO)VEREDA:"",""May  5 2016 "",""FC728BA6A3044C49 0D1901A79F31439D 0C7807E697F791C5 B66E02F46CD5D631"",""
                       
                    ""
""10"",""
                        86001-31-21-001-2013-00070-00
                    "",""REST. DER. TERRITORIAL"",""NUEVO MUNDO"",""EL PLACER (PUTUMAYO)VEREDA:"",""May  5 2016 "",""E626E54C6FAE6190 3136783949C02FF9 74D012B84D55043A 5789D6F959CE5753"",""
                       
                    ""

*********           TRUNCATED           ***********

""51"",""
                        86001-31-21-001-2013-00144-00
                    "",""REST. DER. TERRITORIAL"",""LA ESPERANZA"",""VILLARRICA (PUTUMAYO)VEREDA:VILLARRICA"",""Apr 14 2016 "",""3AED75F23703D159 51FE4EB4D597FF07 E0E27359C65D0300 37AD6E42B81E508C"",""
                       
                    ""
""52"",""
                        86001-31-21-001-2014-00574-00
                    "",""REST. DER. TERRITORIAL"",""LA FLORESTA"",""EL PLACER (PUTUMAYO)VEREDA:EL PLACER"",""Apr 13 2016 "",""B50452A56D8EB97F 432B53239E4E6357 CDF0D4943F681D9F 2DEC2731C84741D1"",""
                       
                    ""
""53"",""
                        86001-31-21-001-2014-00578-00
                    "",""REST. DER. TERRITORIAL"","" "","" "",""Apr 13 2016 "",""29EA026175A249F1 681D0CE05A9F827D 5FCE5078AD14A44F B7894219D716D3A5"",""
                       
                    ""
""54"",""
                        86001-31-21-001-2014-00421-00
                    "",""REST. DER. TERRITORIAL"","" "",""EL PLACER (PUTUMAYO)VEREDA:LA ESMERALDA"",""Apr  6 2016 "",""C1FBB0B20F5A3E6E 820EB7B13D27B9DA A668A13027A3BAC0 15256E6866383E9F"",""
                       
                    ""
""55"",""
                        86001-31-21-001-2014-00570-00
                    "",""REST. DER. TERRITORIAL"","" "",""EL PLACER (PUTUMAYO)VEREDA:EL PLACER"",""Mar  2 2016 "",""5F211C33D5457A15 9DF2DA598803E4E2 45E05107114B0B65 48758864D33279F1"",""
                       
                    ""
""56"",""
                        86001-31-21-001-2014-00561-00
                    "",""REST. DER. TERRITORIAL"",""BARRIO 20 DE JULIO"",""EL PLACER (PUTUMAYO)VEREDA:EL PLACER"",""Feb 29 2016 "",""ECEEE6C6FCC3ECDA 2101DE0E718CE1CA EA3D1C557041B0A0 172CF1A3D12AC7C9"",""
                       
                    ""
""57"",""
                        86001-31-21-001-2014-00559-00
                    "",""REST. DER. TERRITORIAL"","" "",""EL PLACER (PUTUMAYO)VEREDA:"",""Feb 26 2016 "",""291FB6DDA89681BD A610736BC2FADBF3 25BE95EBFDA1053A 05228DC88EBA4279"",""
                       
                    ""
""58"",""
                        86001-31-21-001-2014-00565-00
                    "",""REST. DER. TERRITORIAL"","" "",""EL PLACER (PUTUMAYO)VEREDA:EL PLACER"",""Feb 17 2016 "",""F31E9CF7B63269C6 F5598E0478418491 40A1DCAF5943E7E0 7A93E3DADBD0432D"",""
                       
                    ""
""59"",""
                        86001-31-21-001-2014-00324-00
                    "",""REST. DER. TERRITORIAL"","" "",""EL PLACER (PUTUMAYO)VEREDA:"",""Feb  9 2016 "",""D505B5A9FB9CF517 C143606A1C6B1093 CC2A1E4DFCA218D4 841030756B7879C1"",""
                       
                    ""
""60"",""
                        86001-31-21-001-2014-00567-00
                    "",""REST. DER. TERRITORIAL"",""EL PORVENIR"",""EL PLACER (PUTUMAYO)VEREDA:SAN JUAN BOSCO"",""Feb  9 2016 "",""756806F4F98E4F41 A6DDA13B931BE367 93A4F737D58B6E80 8CA2DCC8DEAAC6F7"",""
                       
                    ""
""61"",""
                        86001-31-21-001-2014-00556-00
                    "",""REST. DER. TERRITORIAL"","" "",""EL PLACER (PUTUMAYO)VEREDA:"",""Jan 25 2016 "",""ABD47D37B7259CFB 07299E66EDA89C01 89729FD433806DF9 0524798B7F735C35"",""
                       
                    ""
""62"",""
                        86001-31-21-001-2014-00597-00
                    "",""REST. DER. TERRITORIAL"","" "",""EL PLACER (PUTUMAYO)VEREDA:LOS ANGELES"",""Jan 25 2016 "",""15AF23D5286D5F2F 1698C7E3C58B593C 105B327667160572 44F7568EA1D3A7CD"",""
                       
                    ""
""63"",""
                        86001-31-21-001-2014-00346-00
                    "",""REST. DER. TERRITORIAL"","" "",""EL PLACER (PUTUMAYO)VEREDA:"",""Jan 13 2016 "",""AB8193DF3693FF6A EC8854A6BBE41332 3E8EDA942D7CCFF2 DF76E853A64BB817"",""
                       
                    ""
"
""
""
"""Reg."",""Radicacion"",""Clase"",""Nombre del Predio"",""Municipio/Vereda del predio"",""Fecha Providencia"",""Certificado"",""Descargar""
""1"",""
                        76111-31-21-003-2014-00053-00
                    "",""REST. DER. TERRITORIAL"",""EL JARDIN -LA ESTRELLA"",""CHICORAL (VALLE DEL CAUCA)VEREDA:EL CHICORAL"",""Dec  9 2014 "",""75A34E2C057E86E0 EE9EEB35E7350089 ADDF143716FCB812 A8572258212DD446"",""
                       
                    ""
""2"",""
                        76111-31-21-003-2014-00036-00
                    "",""REST. DER. TERRITORIAL"",""EL BOSQUE"",""LA HABANA (VALLE DEL CAUCA)VEREDA:LA ARENOSA"",""Dec  9 2014 "",""23A72C321882043D 17CAB7053474815C 7AF97A1643F6CC7F 980B8342DB5D2F43"",""
                       
                    ""
""3"",""
                        76111-31-21-003-2014-00006-00
                    "",""REST. DER. TERRITORIAL"",""EL CASERO Y/O LA PLAYITA"",""LA SONORA (VALLE DEL CAUCA)VEREDA:"",""Nov  6 2014 "",""5BBF529269E94524 4F3B203670E4236D 0730F2FDC6D92B48 B15AB4A463B44018"",""
                       
                    ""
""4"",""
                        76111-31-21-003-2013-00026-02
                    "",""REST. DER. TERRITORIAL"",""LA ESPERANZA"",""LA SONORA (VALLE DEL CAUCA)VEREDA:"",""Oct 29 2014 "",""EE00A00A2756AF80 FDF617291BC2EBDA FE6EF3AC2EA258FA 978C83C88368458B"",""
                       
                    ""
""5"",""
                        76111-31-21-003-2013-00028-00
                    "",""REST. DER. TERRITORIAL"",""CASA LOTE CARRERA 2 # 4 22"",""VENECIA (VALLE DEL CAUCA)VEREDA:VENECIA"",""Oct 28 2014 "",""980CD896F8EE84CD A71EC8AED7C64D86 C7A4878761BA821E 4FF614CEC37B1312"",""
                       
                    ""
""6"",""
                        76111-31-21-003-2013-00020-00
                    "",""REST. DER. TERRITORIAL"",""LA PLAYA"",""EL TABOR - PUENTE BLANCO (VALLE DEL CAUCA)VEREDA:"",""Oct 28 2014 "",""F7F5DD5C2079FF69 6B4F94AA6B520591 8041CD9D7B012252 609886C388694619"",""
                       
                    ""
""7"",""
                        76111-31-21-003-2013-00025-00
                    "",""REST. DER. TERRITORIAL"",""LA OCULTA"",""FENICIA (VALLE DEL CAUCA)VEREDA:LA ZULIA"",""Oct 28 2014 "",""1353D863E8F4B18F C1CBA89D1304A50D 8FEBB6CD8FAFB8A6 9A90446506FB74DD"",""
                       
                    ""
""8"",""
                        76111-31-21-003-2014-00027-00
                    "",""REST. DER. TERRITORIAL"",""LA RIVERA"",""GALICIA (VALLE DEL CAUCA)VEREDA:"",""Oct 28 2014 "",""1C42D3791E3CE0B9 07CA7401E437356E BDE80FC6BB913AE4 A7545ABCAEB3A827"",""
                       
                    ""
""9"",""
                        76111-31-21-003-2013-00017-00
                    "",""REST. DER. TERRITORIAL"",""LA SECRETA"",""EL TABOR - PUENTE BLANCO (VALLE DEL CAUCA)VEREDA:RIO CHIQUITO"",""Oct 28 2014 "",""3CD9150EFD109B0D D6D8275F840B9A45 AEE47F0977CEC784 6985A6078D0EA594"",""
                       
                    ""
""10"",""
                        76111-31-21-003-2013-00019-00
                    "",""REST. DER. TERRITORIAL"",""LA MORENA"",""SALÓNICA (VALLE DEL CAUCA)VEREDA:VOLCANES"",""Oct 28 2014 "",""DCEADC57B15DBB0F 3ED1FB7E509DA1D1 788E7B57D0B558EE DEC4DAC2DE66CBE0"",""
                       
*********           TRUNCATED           ***********
                       
                    ""
""41"",""
                        76111-31-21-003-2013-00070-00
                    "",""REST. DER. TERRITORIAL"",""EL PORVENIR"",""GALICIA (VALLE DEL CAUCA)VEREDA:TETILLAL"",""Oct 23 2014 "",""92DE50071D505A3D 85B6A159B559080A A1E943B4D6A23490 590CBAD4C95ECD1A"",""
                       
                    ""
""42"",""
                        76111-31-21-003-2013-00069-00
                    "",""REST. DER. TERRITORIAL"",""BERLIN Y/O RIO AZUL"",""BOLÍVAR (VALLE DEL CAUCA)VEREDA:EL MACHETE"",""Oct 23 2014 "",""80E3D0AD1D086BC6 6A6CFB3730FC1F9F 02E7EF032E85BBD4 F72E6CE128A9D753"",""
                       
                    ""
""43"",""
                        76111-31-21-003-2013-00068-00
                    "",""REST. DER. TERRITORIAL"",""LA HERMOSA Y/O LA ESPERANZA"",""BITACO (VALLE DEL CAUCA)VEREDA:EL ORO"",""Oct 23 2014 "",""EAD737510B3DFEC1 77A953DB6EAF69A9 9E2EA6A4FB1255CB AF5E341684A959D2"",""
                       
                    ""
""44"",""
                        76111-31-21-003-2013-00061-00
                    "",""REST. DER. TERRITORIAL"",""LOS ARRAYANES"",""GALICIA (VALLE DEL CAUCA)VEREDA:CHICORAL"",""Oct 23 2014 "",""4498326A767BE573 863964E5CF1FBFE0 B9ABF1618081779B 2D3045695F81AC26"",""
                       
                    ""
""45"",""
                        76111-31-21-003-2013-00060-00
                    "",""REST. DER. TERRITORIAL"",""EL RECUERDO"",""GALICIA (VALLE DEL CAUCA)VEREDA:TETILLAL"",""Oct 23 2014 "",""63A0308FE70BBE87 474A06606C29ABDF 18EE6836A4916892 812C02DA212284C3"",""
                       
                    ""
""46"",""
                        76111-31-21-003-2013-00059-00
                    "",""REST. DER. TERRITORIAL"",""LA GRANJITA"",""GALICIA (VALLE DEL CAUCA)VEREDA:CHICORAL"",""Oct 23 2014 "",""A536507C90A248DD 5FCA74C2123E6111 E31E5C7A9BB3845D 3580DC03F69B217C"",""
                       
                    ""
""47"",""
                        76111-31-21-003-2013-00043-00
                    "",""REST. DER. TERRITORIAL"",""LOS LIMONES"",""GALICIA (VALLE DEL CAUCA)VEREDA:TETILLAL ALTO"",""Oct 23 2014 "",""096A2158DD6B3590 0DA66AB554E8E6B0 E3460ACC01920322 B5540E8EAC08EFB7"",""
                       
                    ""
""48"",""
                        76111-31-21-003-2013-00038-00
                    "",""REST. DER. TERRITORIAL"",""VILLA ANDREA"",""GALICIA (VALLE DEL CAUCA)VEREDA:LA MORENA"",""Oct 23 2014 "",""54208A2459632AAA AB14FDEF2DD43DCA 79611728D3B7B2ED 227EA55AE5F4C4E5"",""
                       
                    ""
""49"",""
                        76111-31-21-003-2014-00003-00
                    "",""REST. DER. TERRITORIAL"",""LA CAMELIA"",""CRISTALES (VALLE DEL CAUCA)VEREDA:MORAVITO"",""Oct 22 2014 "",""EBE40B57268B9170 1A7FB384F4D88B59 6F36B37FB4AE4E1A B747E8FACC5B339F"",""
                       
                    ""
"
""
""
"""Reg."",""Radicacion"",""Clase"",""Nombre del Predio"",""Municipio/Vereda del predio"",""Fecha Providencia"",""Certificado"",""Descargar""
""1"",""
                        76111-31-21-003-2015-00029-00
                    "",""REST. DER. TERRITORIAL"",""ADICIONA/COMPLEMENTA"",""ADICIONA/COMPLEMENTA"",""Nov 13 2015 "",""Pendiente por subir soporte documental "",""
                       
                    ""
""2"",""
                        76111-31-21-003-2015-00038-00
                    "",""REST. DER. TERRITORIAL"",""ADICIONA/COMPLEMENTA"",""ADICIONA/COMPLEMENTA"",""Nov  6 2015 "",""Pendiente por subir soporte documental "",""
                       
                    ""
""3"",""
                        76111-31-21-003-2015-00038-00
                    "",""REST. DER. TERRITORIAL"",""SANTA ISABEL"",""DARIÉN (VALLE DEL CAUCA)VEREDA:"",""Oct 21 2015 "",""624C082142B32951 D482955827A130A0 8B803836CB2BDF06 5A1DC63F0CF76B0D"",""
                       
                    ""
""4"",""
                        76111-31-21-003-2015-00029-00
                    "",""REST. DER. TERRITORIAL"",""EL PARAISO"",""EL TABOR - PUENTE BLANCO (VALLE DEL CAUCA)VEREDA:"",""Oct  9 2015 "",""DFFB5EDDCB375EB6 1B8046A12053D5FC F5296C5642304A4C 6C00ED8CF7718F29"",""
                       
                    ""
""5"",""
                        76111-31-21-003-2015-00008-00
                    "",""REST. DER. TERRITORIAL"","" "","" "",""Sep 25 2015 "",""97F0220A1607565D 38E87505A5D3F949 F9D2CF125C4A390A 3589EEB4AD5A555C"",""
                       
                    ""
""6"",""
                        76111-31-21-003-2015-00002-00
                    "",""REST. DER. TERRITORIAL"","" "","" "",""Sep 18 2015 "",""8BCDE083DF205393 6A70F4065D78D7E4 A8ABEF6938F4AC2F 8C66097D4FEA48DE"",""
                       
                    ""
""7"",""
                        76111-31-21-003-2015-00006-00
                    "",""REST. DER. TERRITORIAL"",""EL PORVENIR HOY GUSTO DE SAN ANTONIO"",""TRUJILLO (VALLE DEL CAUCA)VEREDA:"",""Jul 24 2015 "",""A964AE8402AC0E56 172B4F01A823480F C98E7B6745BE661E 1EB2C4C116D706C0"",""
                       
                    ""
""8"",""
                        76111-31-21-003-2015-00007-00
                    "",""REST. DER. TERRITORIAL"",""BETANIA"",""LA HABANA (VALLE DEL CAUCA)VEREDA:PISCINA"",""Jun 10 2015 "",""CE055E3811A8483F 352481D4F75FE0C1 3C1F580B6774EDE9 E29D411A75218B47"",""
                       
                    ""
""9"",""
                        76111-31-21-003-2015-00004-00
                    "",""REST. DER. TERRITORIAL"","" "","" "",""May 15 2015 "",""2DEE61D34FF44746 6E4B9A1DEF4F46D4 AB8D932C0EFF8EA1 680E7F6BFD638351"",""
                       
                    ""
""10"",""
                        76111-31-21-003-2014-00052-00
                    "",""REST. DER. TERRITORIAL"",""LA DANIELA"",""GALICIA (VALLE DEL CAUCA)VEREDA:"",""Jan 20 2015 "",""90DD233FE7278144 8B732D90568362EC 9BC37DA0D39BC2D2 EDAAA68E5991155E"",""
                       
                    ""
""11"",""
                        76111-31-21-003-2014-00051-00
                    "",""REST. DER. TERRITORIAL"",""EL PLACER"",""LA SONORA (VALLE DEL CAUCA)VEREDA:"",""Jan 19 2015 "",""6AB8821FE23BD7EB CAE6A29A802E7326 5AA0A89ABF9BAFD0 95AF83B540313313"",""
                       
                    ""
""12"",""
                        76111-31-21-003-2014-00016-00
                    "",""REST. DER. TERRITORIAL"",""SAN ANTONIO - HORIZONTE"",""LA MELVA (VALLE DEL CAUCA)VEREDA:LA MELVA"",""Jan 19 2015 "",""91944CF96C720CF5 DB7A4EA55AA8C510 F4F45439713B0728 ADA177DF633B5034"",""
                       
                    ""
""13"",""
                        76111-31-21-003-2013-00057-00
                    "",""REST. DER. TERRITORIAL"",""LA MARIA HOY LA DIVISA"",""PORTUGAL DE PIEDRAS (VALLE DEL CAUCA)VEREDA:SANTA RITA"",""Jan 19 2015 "",""458CE9FE7311C574 78EF520637CB8A01 79389B375836CA41 465B9F4A9102EA2F"",""
                       
                    ""
"
""
""
(First 2 Tables a bit truncated in the middle because of the following Error Msg when trying to post my reply:
Your message contains 64369 characters. The maximum number of allowed characters is 60000.
(Ah-ah...!, first time I hit this Limit I think...! :shock: )

The slightly modified Script I used is the following:
Code: Select all
VERSION BUILD=8970419 RECORDER=FX
SET !LOOP 1
'SET !EXTRACT_TEST_POPUP NO
TAB T=1
URL GOTO=http://190.24.134.230/tierras/sentencias.aspx

TAG POS=1 TYPE=A ATTR=HREF:javascript:__doPostBack('ctl00$MainContent$GVSentencias','Select${{!LOOP}}')
'TAG POS=1 TYPE=A ATTR=HREF:javascript:__doPostBack('ctl00$MainContent$GVSentencias','Select${{!LOOP}}') EXTRACT=TXT
'=> 'Seleccionar' Link in Left Column, starting at 'Select$0'.

PAUSE
TAG POS=1 TYPE=TABLE ATTR=* EXTRACT=TXT
PROMPT {{!EXTRACT}}
'PAUSE
'SET !EXTRACT NULL
'TAG POS=2 TYPE=TABLE ATTR=* EXTRACT=TXT
'PROMPT {{!EXTRACT}}

PAUSE
SAVEAS TYPE=EXTRACT FOLDER=* FILE=saki-saki_1.CSV

'Adding 2 extra Empty Rows in CSV to be able to locate Separate Tables:
SAVEAS TYPE=EXTRACT FOLDER=* FILE=saki-saki_1.CSV
SAVEAS TYPE=EXTRACT FOLDER=* FILE=saki-saki_1.CSV
PAUSE
(Tested on iMacros for FF v8.8.2, pale Moon v26.3.3 (=FF47), Win10-x64.)

The 3 extracted Tables contain 63 + 49 + 13 Rows and correspond to the first 3 'Seleccionar' Links you are clicking, which are actually the Links Nr 2 + 3 + 4, because the first Link in the Table on the starting Page starts with 'Select$0' but your 'Select${{!LOOP}}' starts at 'Select$1', skipping the first Link.
If that's your Pb, that you were missing the first Table, simply use:
Code: Select all
SET Select_LOOP {{!LOOP}}
ADD Select_LOOP -1
TAG POS=1 TYPE=A ATTR=HREF:javascript:__doPostBack('ctl00$MainContent$GVSentencias','Select${{Select_LOOP}}')

instead of:
Code: Select all
TAG POS=1 TYPE=A ATTR=HREF:javascript:__doPostBack('ctl00$MainContent$GVSentencias','Select${{!LOOP}}')

Another way (less cumbersome btw than your way of tagging the Links by their HREF Attr) that doesn't require you to "modify" '!LOOP' to start at "0" would be to use stg like:
Code: Select all
TAG POS={{!LOOP}} TYPE=A ATTR=TXT:Seleccionar
(Not tested...)

>

Concerning your 2nd Qt, in order to aggregate all Extracts into one single Table, FF or actually iMacros for FF has the "bad habit" of adding (unnecessary) Double Quotes (that you cannot toggle ON/OFF) around Extracts and especially Tables which makes that when you open your '.CSV' in Excel, a Table is seen as a Single Cell by/in Excel. (iMacros for IE works a bit differently...)
The Trick is to add a Customized "Extract Separator" to '!EXTRACT before and after the real 'EXTRACT', stg like:
Code: Select all
SET !EXTRACT _TABLE_Start_
TAG POS=1 TYPE=TABLE ATTR=* EXTRACT=TXT
ADD !EXTRACT _TABLE_END_
SAVEAS TYPE=EXTRACT FOLDER=* FILE=saki-saki_1.CSV

And after your Script has finished running/looping, to open your '.CSV' in Notepad (not Excel...!) and with a few Find&Replace Actions, to remove all "_TABLE_Start/End_" Tags together with the extra Double Quotes that need to be removed... You might need to experiment a bit until you find the correct ones, so back-up your '.CSV' first before doing the Find&Replace things...!
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6479
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: table export to CSV after "javascript:__doPostBack"

by saki-saki on Fri Jul 22, 2016 9:38 am

Hello Chivracq!
Wow, I'm simply amazed by your quick and excellent answer. How can I pay you back? :D THANK YOU! This is exactly what I needed.
I have a TON of questions regarding another task that I want to solve....can you help me out again? :oops: I would create another thread then?
Again, thank you
saki-saki
 
Posts: 5
Joined: Mon Jul 18, 2016 6:14 pm

Re: table export to CSV after "javascript:__doPostBack"

by chivracq on Fri Jul 22, 2016 8:14 pm

saki-saki wrote:Hello Chivracq!
Wow, I'm simply amazed by your quick and excellent answer. How can I pay you back? :D THANK YOU! This is exactly what I needed.
I have a TON of questions regarding another task that I want to solve....can you help me out again? :oops: I would create another thread then?
Again, thank you

Ah-ah...!, come once to Amsterdam and you can get me a beer.!! :twisted:
Glad I could help btw...! :D

For other Qt's, if not directly related to this Thread, just open some New Threads (and mention each time your FCI (and all Required Info, rather too much Info than too little, I lose quickly Interest in a Thread if I need to ask for supplementary Info), otherwise I don't react...), and I'll reply if I know the Answer...

EDIT:
(Oh, but you've already opened a New Thread I see, perfect, 05h in the morning for me, just back from my Evening, a bit too complicated for me at the moment, I will have a look after some sleep...! (Comments are btw always very useful, would be handy if you could translate the Comments from SP=>ENG in your Script...))
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6479
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: table export to CSV after "javascript:__doPostBack"

by saki-saki on Mon Jul 25, 2016 7:43 am

Hi chivracq...you can count on that beer when I go to NL for sure :D In september I'm moving to Switzerland, if you're passing by as well let me know :)

It would be swell if you can help me out with the other questions I have. I'm pretty sure they're totally basic, nevertheless I will try to work on them today because I'm running out of time with this task :(
Thanks!
saki-saki
 
Posts: 5
Joined: Mon Jul 18, 2016 6:14 pm


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: No registered users and 7 guests

-->