how to extract value from the dropdown list? to csv ?

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.

how to extract value from the dropdown list? to csv ?

by xiaoxiang on Wed Jun 25, 2014 7:46 am

Code: Select all
 <select name="select1">
 <option value="">Select Fruits</option>
 <option value="AP 1">Apple</option>
 <option value="BN">Banana</option>
 <option value="Special">Kiwi</option>
 </select>


i only found imacros able to search the value but how to store the value ?

Code: Select all
TAG POS=1 TYPE=SELECT FORM=NAME:form1 ATTR=NAME:select1 CONTENT=%BN


code in imacros was

Code: Select all
TAG POS=1 TYPE=SELECT:NAME FORM=ID:demo ATTR=TXT:*&&ID:select1 EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=value.csv
 


if selected Banana, how to i save the value BN and not the Banana ?
Last edited by xiaoxiang on Tue Jul 01, 2014 8:21 am, edited 1 time in total.
xiaoxiang
 
Posts: 10
Joined: Wed Jun 25, 2014 7:40 am

Re: how to extract value from the downdown list? to scv ?

by chivracq on Wed Jun 25, 2014 3:37 pm

CIM, I don't read...! :mrgreen:
- (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: how to extract value from the downdown list? to scv ?

by xiaoxiang on Wed Jun 25, 2014 5:07 pm

i had try
TAG POS=1 TYPE=SELECT:NAME FORM=ID:demo ATTR=TXT:*&&ID:select1 EXTRACT=VALUE
TAG POS=1 TYPE=SELECT:NAME FORM=ID:demo ATTR=TXT:*&&ID:select1 EXTRACT=$TXT

not work, any idea :(
xiaoxiang
 
Posts: 10
Joined: Wed Jun 25, 2014 7:40 am

Re: how to extract value from the downdown list? to scv ?

by chivracq on Wed Jun 25, 2014 5:16 pm

CIM...! :mrgreen: I'm your best Friend, answer my Questions...!
And read the Forum Rules, you'll save us both some time... (Going to bed now, you've already lost one day...)
- (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: how to extract value from the downdown list? to scv ?

by xiaoxiang on Thu Jun 26, 2014 4:39 am

sorry, i'm too new here... now i only understand waht is CIM ...- (F)CIM = (Full) Config Info missing: iMacros + Browser + OS with all Versions...

i'm using Firefox version 30.0,
IMacros VERSION BUILD=8820413 RECORDER=FX
OS (windows 7)

hope it's help :D
xiaoxiang
 
Posts: 10
Joined: Wed Jun 25, 2014 7:40 am

Re: how to extract value from the downdown list? to scv ?

by xiaoxiang on Tue Jul 01, 2014 5:10 am

chivracq wrote:CIM...! :mrgreen: I'm your best Friend, answer my Questions...!
And read the Forum Rules, you'll save us both some time... (Going to bed now, you've already lost one day...)


hi, just wonder is there any info i had miss out that you need? please do let me know if there is :mrgreen:

i'm using Firefox version 30.0,
IMacros VERSION BUILD=8820413 RECORDER=FX
OS: windows 7
xiaoxiang
 
Posts: 10
Joined: Wed Jun 25, 2014 7:40 am

Re: how to extract value from the dropdown list? to csv ?

by chivracq on Tue Jul 01, 2014 5:38 am

Oh yeah, sorry for the delay, but I usually lose interest in a Thread if I have to ask several times for Full Config Info or Answers to my Questions as other New Threads get added in the meantime...

Okay..., you want to extract "BN" (= NAME) instead of "Banana" (= VALUE) if I understand you correctly...

I haven't done any Testing myself, but have you tried "EXTRACT=HTM" instead of "EXTRACT=TXT" (or "EXTRACT=TXTALL" even...), because if "ATTR=NAME:"BN"" or stg like that with the "BN" Part is mentioned, then you could grab it with 'EVAL()'...?

And you should correct your Thread Title:
- "downdown" => dropdown
- "scv" => csv
Your Thread cannot be found otherwise by other Users searching the Forum with a similar Question...
Last edited by chivracq on Sun Jul 06, 2014 1:12 am, edited 1 time in total.
- (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: how to extract value from the downdown list? to scv ?

by xiaoxiang on Sat Jul 05, 2014 5:07 pm

chivracq wrote:Oh yeah, sorry for the delay, but I usually lose interest in a Thread if I have to ask several times for Full Config Info or Answers to my Questions as other New Threads get added in the meantime...

Okay..., you want to extract "BN" (= NAME) instead of "Banana" (= VALUE) if I understand you correctly...

I haven't done any Testing myself, but have you tried "EXTRACT=HTM" instead of "EXTRACT=TXT" (or "EXTRACT=TXTALL" even...), because if "ATTR=NAME:"BN"" or stg like that with the "BN" Part is mentioned, then you could grab it with 'EVAL()'...?

And you should correct your Thread Title:
- "downdown" => dropdown
- "scv" => csv
Your Thread cannot be found otherwise by other Users searching the Forum with a similar Question...


hi, i had try "EXTRACT=HTM", "EXTRACT=TXTALL" ,

i think TXTALL can't get the value, as the result are Select Fruits[OPTION]Apple[OPTION]Banana[OPTION]Kiwi


for HTM, i get such result : <select name="select1"> <option value="">Select Fruits</option>
<option value="AP 1">Apple</option>
<option value="BN">Banana</option>
<option value="Special">Kiwi</option> </select>

but i'm not good in javascript and not sure how to use the EVAL() function, was trying to get the selected drowndown list value :cry:
xiaoxiang
 
Posts: 10
Joined: Wed Jun 25, 2014 7:40 am

Re: how to extract value from the dropdown list? to csv ?

by chivracq on Sun Jul 06, 2014 1:49 am

OK, as you don't mention any URL for your Site, I cannot do any "more educated" Testing, I thought the Data you mentioned came from one of the Demo-Macros, but then I didn't find which one in a quick look through and I'm not going to review them all...

But OK, "EXTRACT=HTM" returns at least the "BN" Data you are interested in, very close to the "Banana" Data that you already know or easily can extract from the Page, meaning you now indeed can pull out "BN" out of the String using 'EVAL()' with 'indexOf("Banana")', then you subtract 4 to that 'indexOf' Value to get the 'indexOf' Value of the "B" in "BN" and you use 'slice()' or 'substr()' or 'substring()' to retrieve "BN"...

(And thanks for correcting your Thread Title, but you've done it again in your last Post: It's not "drowndown"..., grrr...! Pay attention to your Spelling...!)
- (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: how to extract value from the dropdown list? to csv ?

by chivracq on Sun Jul 13, 2014 4:05 am

And...?, (one week later!), any Follow-up...?
- (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: how to extract value from the dropdown list? to csv ?

by xiaoxiang on Sun Aug 28, 2016 10:12 pm

chivracq wrote:And...?, (one week later!), any Follow-up...?


so sorry, i really miss out this Thread.
Thanks for providing the advise,
Previously i not sure how to use the EVAL() function, so i just put the entire value to the selection to make it work. (yeah i know, this is not the correct way)

<select name="select1"> <option value="">Select Fruits</option>
<option value="AP<<SS>SP>1">AP<<SS>SP>1</option>
<option value="BN">BN</option>
<option value="Special">Special</option></select>

maybe i should spent some time to improve back the script with using EVAL() and regular expression to match the result
xiaoxiang
 
Posts: 10
Joined: Wed Jun 25, 2014 7:40 am


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: No registered users and 2 guests

-->