Table data extraction-format not retained

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 data extraction-format not retained

by pratiksha27.jain on Wed Dec 28, 2016 1:09 am

Hi,

Browser : Internet explorer 11.0
Os : windows 7 enterprise
I MAcro :11.1.495.5175


Trying to extract a table in csv.

I have successully extracted the table but not able to retain the format.
Can't use firefox as the official site is accessible through internet explorer only.

any help on this highly appreciated :).

thank you

Macro code used :

VERSION BUILD=11.1.495.5175
TAB T=1
TAB CLOSEALLOTHERS
SET !PLAYBACKDELAY 0.2
URL GOTO=http://20.17.236.130:7220/nbALoginModule/jsp/Links.jsp
'change login id as per the requirement
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:uid CONTENT=nblife41
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD ATTR=NAME:password CONTENT=Life1234
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=NAME:submitLogin
ONDIALOG POS=1 BUTTON=NO
'change the environment name as per the requirment
'TAG POS=1 TYPE=A ATTR=TXT:LnbA<SP>Dev<SP>-<SP>2
'TAG POS=1 TYPE=A ATTR=TXT:LnbA<SP>IST<SP>-<SP>2
TAG POS=1 TYPE=A ATTR=TXT:LnbA<SP>Admin-Cloud<SP>UAT
'New tab opened
'TAG POS=1 TYPE=A ATTR=TXT:LnbA<SP>QA7
TAB T=2
'New tab opened
TAB T=3
TAB T=2
TAB CLOSE
TAB T=2
FRAME NAME=mainContentFrame
TAG POS=1 TYPE=TD ATTR=ID:dm0m0i0tdText
TAG POS=1 TYPE=TD ATTR=ID:dm0m1i0tdText
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=NAME:menu:coordmenuForm:menuFormButton
TAG POS=1 TYPE=TD ATTR=ID:dm0m1i0tdText
wait seconds=5

FRAME NAME=file
SET !EXTRACT_TEST_POPUP NO

TAG POS=1 TYPE=DIV ATTR=ID:pollersTableData EXTRACT=TXT

SAVEAS TYPE=EXTRACT FOLDER=C:\Users\pjain74\Desktop\macro FILE=pollers1_data.csv



format of data extracted : file attached

The cloumns should appear like this :

XML103 Document Input (N2DOCIN) Waiting 2 50
Attachments
csv-snapshot.JPG
snapshot of csv file -the output
pratiksha27.jain
 
Posts: 19
Joined: Wed Dec 28, 2016 12:24 am

Re: Table data extraction-format not retained

by chivracq on Wed Dec 28, 2016 8:11 am

pratiksha27.jain wrote:Hi,
Code: Select all
Browser : Internet explorer 11.0
Os : windows 7 enterprise
I MAcro :11.1.495.5175


Trying to extract a table in csv.

I have successully extracted the table but not able to retain the format.
Can't use firefox as the official site is accessible through internet explorer only.

any help on this highly appreciated :).

thank you

Macro code used :
Code: Select all
VERSION BUILD=11.1.495.5175
TAB T=1
TAB CLOSEALLOTHERS
SET !PLAYBACKDELAY 0.2
URL GOTO=http://20.17.236.130:7220/nbALoginModule/jsp/Links.jsp
'change login id as per the requirement
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:uid CONTENT=xxx
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD ATTR=NAME:password CONTENT=yyy
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=NAME:submitLogin
ONDIALOG POS=1 BUTTON=NO
'change the environment name as per the requirment
'TAG POS=1 TYPE=A ATTR=TXT:LnbA<SP>Dev<SP>-<SP>2
'TAG POS=1 TYPE=A ATTR=TXT:LnbA<SP>IST<SP>-<SP>2
TAG POS=1 TYPE=A ATTR=TXT:LnbA<SP>Admin-Cloud<SP>UAT
'New tab opened
'TAG POS=1 TYPE=A ATTR=TXT:LnbA<SP>QA7
TAB T=2
'New tab opened
TAB T=3
TAB T=2
TAB CLOSE
TAB T=2
FRAME NAME=mainContentFrame
TAG POS=1 TYPE=TD ATTR=ID:dm0m0i0tdText
TAG POS=1 TYPE=TD ATTR=ID:dm0m1i0tdText
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=NAME:menu:coordmenuForm:menuFormButton
TAG POS=1 TYPE=TD ATTR=ID:dm0m1i0tdText
wait seconds=5

FRAME NAME=file
SET !EXTRACT_TEST_POPUP NO

TAG POS=1 TYPE=DIV ATTR=ID:pollersTableData EXTRACT=TXT

SAVEAS TYPE=EXTRACT FOLDER=C:\Users\pjain74\Desktop\macro FILE=pollers1_data.csv

format of data extracted : file attached

The cloumns should appear like this :

Code: Select all
XML103 Document Input     (N2DOCIN)       Waiting   2       50

You've left some Login&Password in your Macro, even if the Site is only "internally "accessible from your Intranet I suppose, so we cannot access it anyway... I've obfuscated them in my Quote if that was a mini-Mistake from you...

Hum, OK, as I cannot access the Page, that always makes "things" a bit more complicated as I cannot have a look at the HTML Structure of the Page and do any Testing of my own, grrr...!, but OK, a few things can play a role...:

1- You manage to extract your whole Table in one Statement but you do it at the 'DIV' Level containing the Table. Try to do it at the 'TABLE' Level, iMacros then has a Mechanism to convert the whole Table Data Structure into Cols and Rows following the '[TR]' and '[TD]' HTML Tags and translating them into Rows and Cells when saving to a '.CSV', using stg like:
Code: Select all
TAG POS=1 TYPE=TABLE ATTR=ID:*pollers* EXTRACT=TXT
You may have to play with 'POS=n' or find out what the real Name of the Table is from the Source Code, especially if it doesn't contain "pollers"...

2- From the small Example you provided with 1 Row for the "expected Result", your Data looks 'TAB' separated and not 'Comma' separated.
You didn't mention in which Program you open your '.CSV', but if you opened it in Notepad, the Result that you actually get is indeed the Display you would get as Notepad discards 'TAB's and Soft Returns. You would probably get better Results in WordPad or Excel/OO-Calc where you can even specify the 'TAB' as a Separator when "importing" the Data from the '.CSV' into Excel/OO.

3- In iMacros for IE, you have some Option where you can force iMacros to use the OS Regional Settings where you can specify which Data Delimiter and Separator you want to use. You can try playing with that Option.

4- You mentioned FF and that could be an idea indeed as iMacros for IE and iMacros for FF use a different Mechanism for saving Data with 'SAVEAS TYPE=EXTRACT' to a 'CSV' as iMacros for FF always encloses the Data with Double Quotes as Delimiter while iMacros for IE doesn't use any Delimiter. You can even use '!DATASOURCE_DELIMITER' to change that Setting.
You mention that the Site requires to use IE, but you could always change your User Agent in FF using some Add-on or the '!USERAGENT' Command to pretend to be IE and to to run your Script from FF.

5- You could always extract the Data from the Table Field (= Cell) by Field from the Page in multiple Extracts instead of one Extract Statement at the High Level 'DIV' containing the whole Data like you do. But hum, might become a bit cumbersome, especially if the Size of the Table changes and you don't know how many Rows to expect.

6- Depending on how the Data gets extracted and stored in the '!EXTRACT' Var, it is always possible to manipulate this Data from iMacros with 'EVAL()' (with some Global 'replace()' Statements) if you are "happy" with the Format and how iMacros tries to handle it, before saving the Data to your '.CSV', but hum, can be cumbersome as well, ah-ah...!

Well, I hope those Suggestions help a bit already, you could always upload some HTML Saveas of your Page to your Thread otherwise if you don't come out by yourself, (Zipped, Max 256Kb), then I can have a look...
- (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: 6474
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Table data extraction-format not retained

by pratiksha27.jain on Thu Dec 29, 2016 12:09 am

hi chivracq.

Thank you for all your time on this.

I tried with TAG POS=1 TYPE=TABLE ATTR=ID:*pollers* EXTRACT=TXT but all am getting is #EANF# in the output.


Here attaching the source code for your reference.

And I tried opening CSV in excel.Even if i try to extract data in txt doc its same.


not able to attach txt file..so pasting here the piece of xml..if it helps

--------------\

<tbody>
<tr class="ovEvenRow">
<td class="ovColIcon"><input id="pollersForm:pollersTable:0:commCol1b" type="image" src="images/flag-onwhite.gif" name="pollersForm:pollersTable:0:commCol1b" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};null" class="ovViewIconfalse" /></td>
<td class="ovColText195ML"><a id="pollersForm:pollersTable:0:description" href="#" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:0:description';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;"><textarea name="pollersForm:pollersTable:0:_id4" class="ovAutoProcessTableData" readonly="readonly">XML103 Document Input (N2DOCIN)</textarea></a></td>
<td class="ovColText50"><a id="pollersForm:pollersTable:0:statusCol" href="#" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:0:statusCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;" class="ovFullCellSelect">Waiting</a></td>
<td class="ovColNum"><a id="pollersForm:pollersTable:0:successCol" href="#" style="width: 100%;" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:0:successCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;" class="ovFullCellSelect">34</a></td>
<td class="ovColNum"><a id="pollersForm:pollersTable:0:failureCol" href="#" style="width: 100%;" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:0:failureCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;" class="ovFullCellSelect">0</a></td>
<td class="ovColText195ML"><a id="pollersForm:pollersTable:0:errorCol" href="#" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:0:errorCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;"><textarea name="pollersForm:pollersTable:0:_id9" class="ovAutoProcessTableData" readonly="readonly"></textarea></a></td>
</tr>

********************************************************************************************************************************************************************
<tr class="ovOddRow">
<td class="ovColIcon"><input id="pollersForm:pollersTable:1:commCol1b" type="image" src="images/flag-onwhite.gif" name="pollersForm:pollersTable:1:commCol1b" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};null" class="ovViewIconfalse" /></td>
<td class="ovColText195ML"><a id="pollersForm:pollersTable:1:description" href="#" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:1:description';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;"><textarea name="pollersForm:pollersTable:1:_id4" class="ovAutoProcessTableData" readonly="readonly">Other Documents Input (N2DOCIN)</textarea></a></td>
<td class="ovColText50"><a id="pollersForm:pollersTable:1:statusCol" href="#" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:1:statusCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;" class="ovFullCellSelect">Waiting</a></td>
<td class="ovColNum"><a id="pollersForm:pollersTable:1:successCol" href="#" style="width: 100%;" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:1:successCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;" class="ovFullCellSelect">13</a></td>
<td class="ovColNum"><a id="pollersForm:pollersTable:1:failureCol" href="#" style="width: 100%;" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:1:failureCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;" class="ovFullCellSelect">0</a></td>
<td class="ovColText195ML"><a id="pollersForm:pollersTable:1:errorCol" href="#" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:1:errorCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;"><textarea name="pollersForm:pollersTable:1:_id9" class="ovAutoProcessTableData" readonly="readonly"></textarea></a></td>




and so on...


thank you.
pratiksha27.jain
 
Posts: 19
Joined: Wed Dec 28, 2016 12:24 am

Re: Table data extraction-format not retained

by pratiksha27.jain on Thu Feb 02, 2017 2:53 am

sourcecode.rar
source code of the table am trying to access
(8.83 KIB) Downloaded 66 times



hi,

attached is the source code.

I checked my regional settings for csv. it is having ','.
I checked the option on imacrso as well to use my regional settings.


Still getting the ouput as (snapshot attached)
sourcecode.rar
source code of the table am trying to access
(8.83 KIB) Downloaded 66 times


please help and also is there any way to get the extracted data in new tab for every loop it runs (IE browser).

thanks
Attachments
output.jpg
this is how my data is extracted , without any delimiter :(
pratiksha27.jain
 
Posts: 19
Joined: Wed Dec 28, 2016 12:24 am

Re: Table data extraction-format not retained

by pratiksha27.jain on Thu Feb 02, 2017 5:32 am

OMG!! :lol: :D :)

I got it working.
can't believe ..I did it!!

happy happy!!


the changes i done is
I wrote
TAG POS=3 TYPE=TABLE ATTR=TXT:* EXTRACT=TXT

instead of

'TAG POS=1 TYPE=DIV ATTR=ID:pollersTableData EXTRACT=TXT

in the code..i shared in first post

it's working..

correct_output.jpg
and the desired format is here :)



if anybody needs any help on this..please feel free to contact me on pratiksha27.jain@gmail.com
pratiksha27.jain
 
Posts: 19
Joined: Wed Dec 28, 2016 12:24 am

Re: Table data extraction-format not retained

by chivracq on Thu Feb 02, 2017 9:02 am

pratiksha27.jain wrote:hi chivracq.

Thank you for all your time on this.

I tried with
Code: Select all
TAG POS=1 TYPE=TABLE ATTR=ID:*pollers* EXTRACT=TXT
but all am getting is #EANF# in the output.

Here attaching the source code for your reference.

And I tried opening CSV in excel.Even if i try to extract data in txt doc its same.

not able to attach txt file..so pasting here the piece of xml..if it helps

--------------\
Code: Select all
<tbody>
<tr class="ovEvenRow">
<td class="ovColIcon"><input id="pollersForm:pollersTable:0:commCol1b" type="image" src="images/flag-onwhite.gif" name="pollersForm:pollersTable:0:commCol1b" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};null" class="ovViewIconfalse" /></td>
<td class="ovColText195ML"><a id="pollersForm:pollersTable:0:description" href="#" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:0:description';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;"><textarea name="pollersForm:pollersTable:0:_id4" class="ovAutoProcessTableData" readonly="readonly">XML103 Document Input (N2DOCIN)</textarea></a></td>
<td class="ovColText50"><a id="pollersForm:pollersTable:0:statusCol" href="#" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:0:statusCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;" class="ovFullCellSelect">Waiting</a></td>
<td class="ovColNum"><a id="pollersForm:pollersTable:0:successCol" href="#" style="width: 100%;" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:0:successCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;" class="ovFullCellSelect">34</a></td>
<td class="ovColNum"><a id="pollersForm:pollersTable:0:failureCol" href="#" style="width: 100%;" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:0:failureCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;" class="ovFullCellSelect">0</a></td>
<td class="ovColText195ML"><a id="pollersForm:pollersTable:0:errorCol" href="#" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:0:errorCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;"><textarea name="pollersForm:pollersTable:0:_id9" class="ovAutoProcessTableData" readonly="readonly"></textarea></a></td>
</tr>

********************************************************************************************************************************************************************
Code: Select all
<tr class="ovOddRow">
<td class="ovColIcon"><input id="pollersForm:pollersTable:1:commCol1b" type="image" src="images/flag-onwhite.gif" name="pollersForm:pollersTable:1:commCol1b" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};null" class="ovViewIconfalse" /></td>
<td class="ovColText195ML"><a id="pollersForm:pollersTable:1:description" href="#" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:1:description';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;"><textarea name="pollersForm:pollersTable:1:_id4" class="ovAutoProcessTableData" readonly="readonly">Other Documents Input (N2DOCIN)</textarea></a></td>
<td class="ovColText50"><a id="pollersForm:pollersTable:1:statusCol" href="#" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:1:statusCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;" class="ovFullCellSelect">Waiting</a></td>
<td class="ovColNum"><a id="pollersForm:pollersTable:1:successCol" href="#" style="width: 100%;" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:1:successCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;" class="ovFullCellSelect">13</a></td>
<td class="ovColNum"><a id="pollersForm:pollersTable:1:failureCol" href="#" style="width: 100%;" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:1:failureCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;" class="ovFullCellSelect">0</a></td>
<td class="ovColText195ML"><a id="pollersForm:pollersTable:1:errorCol" href="#" isClicked="false" onclick="try{top.lastButtonClicked = this; top.showTimedWait('processing request',500);}catch(ex){};document.forms['pollersForm']['pollersForm:_idcl'].value='pollersForm:pollersTable:1:errorCol';;try{if(window.event.ctrlKey){document.forms['pollersForm']['CTRL_KEY'].value='TRUE';}}catch(ctrlex){};;try{if(window.event.shiftKey){document.forms['pollersForm']['SHIFT_KEY'].value='TRUE';}}catch(shiftex){};; document.forms['pollersForm'].submit(); return false;"><textarea name="pollersForm:pollersTable:1:_id9" class="ovAutoProcessTableData" readonly="readonly"></textarea></a></td>

and so on...

thank you.


pratiksha27.jain wrote:
sourcecode.rar

hi,

attached is the source code.

I checked my regional settings for csv. it is having ','.
I checked the option on imacrso as well to use my regional settings.

Still getting the ouput as (snapshot attached)
sourcecode.rar


please help and also is there any way to get the extracted data in new tab for every loop it runs (IE browser).

thanks


pratiksha27.jain wrote:OMG!! :lol: :D :)

I got it working.
can't believe ..I did it!!

happy happy!!


the changes i done is
I wrote
TAG POS=3 TYPE=TABLE ATTR=TXT:* EXTRACT=TXT

instead of

'TAG POS=1 TYPE=DIV ATTR=ID:pollersTableData EXTRACT=TXT

in the code..i shared in first post

it's working..

correct_output.jpg


if anybody needs any help on this..please feel free to contact me on pratiksha27.jain@gmail.com

Ah-ah...!, didn't find the Time/Energy to go digging in your "heavy" Case again, ah-ah...! Oh no, that's more likely because you had not really reacted to the 6 Suggestions I had done in my first Reply...
But you managed to find a/the Solution, very-very good...! :D

But, ah-ah...!, you'll notice that was exactly my first Suggestion from my first Reply when you had opened the Thread:
1- You manage to extract your whole Table in one Statement but you do it at the 'DIV' Level containing the Table. Try to do it at the 'TABLE' Level, iMacros then has a Mechanism to convert the whole Table Data Structure into Cols and Rows following the '[TR]' and '[TD]' HTML Tags and translating them into Rows and Cells when saving to a '.CSV', using stg like:
Code: Select all
TAG POS=1 TYPE=TABLE ATTR=ID:*pollers* EXTRACT=TXT

You may have to play with 'POS=n' or find out what the real Name of the Table is from the Source Code, especially if it doesn't contain "pollers"...

And I guess "my" Statement is probably still more "precise" than yours with 'POS=1' on 'ID'/'NAME' as it is always best to try to get 'POS=n' with 'n' as low as possible, as from your 'POS=3', you can see there are already 2 more Tables on the Page before the one you want..., which can always be a "Risk" as if any Functionality on the Page creates another Table before "yours", than yours will shift to 'POS=4' etc...

But very good that you found a/the Solution and shared it...!
As you can see, you could have already solved your Pb more than 1 month ago directly when you had opened your Thread, if you had followed my Suggestions, instead of more or less waiting for sbd to write your Script, without really reacting/trying the 6 Suggestions I had done in my first Reply, ah-ah...! :idea:

But I see that you've already opened another Thread, ah-ah...! I haven't looked at it yet...
- (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: 6474
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Table data extraction-format not retained

by pratiksha27.jain on Fri Feb 03, 2017 12:54 am

I read all of you solutions.

but probably couldnt understand how to implement it.

but one day...trying hard. and hard...i finally got the solution

now reading your solutions i can understand now ..what you were trying to say :)
pratiksha27.jain
 
Posts: 19
Joined: Wed Dec 28, 2016 12:24 am


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: No registered users and 4 guests

-->