Extracting from dropdown by xpath

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.

Extracting from dropdown by xpath

by dyneck on Sat Mar 19, 2016 3:03 pm

VERSION BUILD=8961227
WIndows XP
Firefox 40.0.1

Is it possible to extract from dropdown if I mark it by xpath ?

Code: Select all
TAG XPATH="/html/body/div[2]/div/div[4]/div/div[1]/div[6]/div[2]/div[2]/div/div[3]/div/table/tbody/tr[1]/td[3]/select" CONTENT=%2 EXTRACT=TXT


I receive:
wrong format of TAG command, line 4 (Error code: -910)

As it is mentioned here -> http://wiki.imacros.net/Data_Extraction ... T_Elements it works for select elements but if it works for select elements marked by xpath ?
dyneck
 
Posts: 7
Joined: Sun Mar 13, 2016 9:51 am

Re: Extracting from dropdown by xpath

by chivracq on Sat Mar 19, 2016 3:42 pm

dyneck wrote:VERSION BUILD=8961227
WIndows XP
Firefox 40.0.1

Is it possible to extract from dropdown if I mark it by xpath ?

Code: Select all
TAG XPATH="/html/body/div[2]/div/div[4]/div/div[1]/div[6]/div[2]/div[2]/div/div[3]/div/table/tbody/tr[1]/td[3]/select" CONTENT=%2 EXTRACT=TXT


I receive:
wrong format of TAG command, line 4 (Error code: -910)

As it is mentioned here -> http://wiki.imacros.net/Data_Extraction ... T_Elements it works for select elements but if it works for select elements marked by xpath ?

Oh...!, this time you manage to mention (perfectly...!) your FCI when opening a Thread... :D Very good, but what about following up on your previous Thread...? (Sorry but I only help Users who use the Forum a bit correctly in all their Threads... (And I think I know the Answer to your current Thread, if that can motivate you a bit... :idea: ))
- (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: 6484
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Extracting from dropdown by xpath

by dyneck on Sun Mar 20, 2016 1:39 am

But my previous topic was about sound alert and this one is about extracting data from dropdown by xpath.
It's different problem. I even put it in different subforum and do it for purpose.
dyneck
 
Posts: 7
Joined: Sun Mar 13, 2016 9:51 am

Re: Extracting from dropdown by xpath

by chivracq on Sun Mar 20, 2016 3:48 am

dyneck wrote:But my previous topic was about sound alert and this one is about extracting data from dropdown by xpath.
It's different problem. I even put it in different subforum and do it for purpose.

Yep, I know the 2 Threads are about different Pb's, that's not the point...
This 2nd (Current) Thread is just perfect (except that I miss the URL of your Page to check if the Solution I have in mind is correct indeed), but I don't want to answer it until you've finished your 1st Thread neatly and useful for everybody using the Forum...

I asked you to mention your FCI in your previous Thread, you didn't do it.
I already gave you some direction in that Thread, you then need to follow up, one week later, either you managed to solve your Pb, then you are expected to share your Solution, or you still have the Pb then you post how far you came and what you've tried and where you get stuck... until the Thread is neatly finished with a Solution for you and other Users searching the Forum...
That's what I mean by "using the Forum a bit correctly"...
- (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: 6484
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Extracting from dropdown by xpath

by dyneck on Sun Mar 20, 2016 4:41 am

OK, I undertand. I finished first thread. It might be useful because it's different solution than posted so far here :)

As for this subject I didn't give website url becasue you have to register so it won't help.

Could you post your advice ?
Last edited by dyneck on Sun Mar 20, 2016 7:56 am, edited 1 time in total.
dyneck
 
Posts: 7
Joined: Sun Mar 13, 2016 9:51 am

Re: Extracting from dropdown by xpath

by chivracq on Sun Mar 20, 2016 6:18 am

dyneck wrote:OK, I undertand. I finished first thread. It might be useful because it's different solution than posted so far here :)

As for this subject I didn't give website url becasue you have to register there so it's useless.

OK, Thanks for finishing your first Thread neatly and sharing your Solution, perfect...! :D

OK, for this Current Thread, I've never used 'TAG' with 'XPATH' and without being able to play myself with the Page, I cannot check if the Solution/Reason I have in mind is correct..., and hum, even if you can't post the URL because of Registration etc..., you could still upload some (zipped, Max 256Kb) HTML Saveas of your Page to your Thread, if the DDLB is not populated dynamically, or find some similar Web-Site for which you can post the URL and the 'XPATH' Statement...

But, what strikes me in your Statement is that I think you cannot use both the 'CONTENT' and 'EXTRACT' Parameters in the same 'TAG' Statement, in 'XPATH' or "Standard" Mode...
If you want to extract the Current Active Option selected, you need to remove the 'CONTENT' Parameter, or use 2 Statements, one first to select your Option in the DDLB and then the 'EXTRACT=TXT' just after.

If the 'EXTRACT=TXT' doesn't work exactly like you would like, you would have to use 'EXTRACT=TXTALL' to retrieve all Options in the DDLB and then use the Technique referred from the Link you provided from the Wiki with Info about selecting/extracting one Option which links to some other Thread on the Forum:
- How to extract value from option tag instead of text
That Thread was moved by TechSupport to some 'Howto' Sub-Forum and it's not possible to post in it anymore, but I would have a much more simple Solution btw (well, in my Opinion, I don't do 'REGEXP'...!) than the one which is posted, using 'EVAL()' + 'split()', as your "%2" is simply the Position of your Value in the Array returned by 'split()'...
Here is a similar Thread where I already posted a similar/related Solution:
- Number of Options in a Select tag
Last edited by chivracq on Sun Mar 20, 2016 12:48 pm, 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: 6484
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Extracting from dropdown by xpath

by dyneck on Sun Mar 20, 2016 12:30 pm

Thanks, I used EXTRACT and CONTENT in separate TAGs elements before but I thought that maybe there is some quicker solution because executing TAG takes some time (although I reduced TIMEOUT STEP to one second).
dyneck
 
Posts: 7
Joined: Sun Mar 13, 2016 9:51 am


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: No registered users and 4 guests

-->