'Extracting data from a website using iMacros
I am really new to iMacros but seem to have a basic understanding of how it works. However, I have two problems that I just can't seem to resolve. The iMacros loads from and executable service that is ran whenever needed to get information. Once the data is extracted the service takes it and writes it to a file on the servers C drive. This has been working fine up till about a month ago. Amazon changed the website and now I can't get the script to cooperate. All help resolving this would be greatly appreciated.
- The script does not extract the text, and
- A new iMacros browser opens after each run-through of the script.
I have researched the internet, manipulated the script many different ways, and I have used the record option, as well as the wizard to create the script to extract the data. I'm not sure what I am missing. My script is below.
VERSION BUILD=7401598
TAB T=1
URL GOTO=https://sellercentral.amazon.com/gp/fba/revenue-calculator/index.html/ref=au_xx_cont_xx?ie=UTF8&lang=en_US
WAIT SECONDS=10
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:search-form ATTR=ID:search-string CONTENT={{Asin}}
WAIT SECONDS=10
TAG POS=1 TYPE=BUTTON ATTR=ID:search-products
WAIT SECONDS=10
TAG POS=1 TYPE=BUTTON ATTR=ID:update-fees-link
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Order<SP>Handling
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Pick<SP>&<SP>Pack
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Weight<SP>Handling
WAIT SECONDS=10
The text I need to extract is Order handling, Pick & Pack, Weight Handling.
Solution 1:[1]
You should try placing EXTRACT=TXT after the commands. Also check the html of page and make a command if record doesn't work. If for example you have a link on a page this would be it's HTML code.
<a href="www.somestuff.com">click me</a>
iMacros to extract link and text from this are.
TAG POS=1 TYPE=A ATTR=HREF:www.somestuff.com EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=HREF:www.somestuff.com EXTRACT=HREF
There are few other variations but this is the main part. In your case this would be the proper code.
TAG POS=1 TYPE=BUTTON ATTR=ID:search-products EXTRACT = TXT
WAIT SECONDS=10
TAG POS=1 TYPE=BUTTON ATTR=ID:update-fees-link EXTRACT = TXT
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Order<SP>Handling EXTRACT = TXT
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Pick<SP>&<SP>Pack EXTRACT = TXT
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=TXT:Weight<SP>Handling EXTRACT = TXT
WAIT SECONDS=10
Try it and please use iMacros FireFox addon for this.
Edit:
You can declare one scraping macro in JavaScript.
var macroScrape;
macroScrape ="CODE:";
macroScrape +="TAG POS=1 TYPE=BUTTON ATTR=ID:search-products EXTRACT = TXT";
iimPlay(macroScrape)
var text=iimGetLastExtract();
alert(text);
I use only once EXTRACT command in once macro. If I need more info scraped I use more macro codes declared as a variable in the example above. This could work if you know how to use it.
iMacros support is sometimes really slow.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |