Extracting data from a website using iMacros - 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.

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.
click me
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.

Related

iMacros: Script pastes the Text "CONTENT={{!CLIPBOARD}}" rather than the actual Clipboard Content?

I am trying to get iMacros for Firefox (v10.0.2) to copy/paste data, the copying side is working (as confirmed by iMacros pop-ups) but when pasting instead of pasting the Clipboard content, it's actually pasting "CONTENT={{!CLIPBOARD}}" (without the quotation marks).
This is my Script...:
FRAME F=0
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivsml EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!CLIPBOARD}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
My Config Info:
iMacros version = 10.0.2.1450
Firefox version = 70.0.1 (64bit)
Win 10 (64bit)
Any help greatly appreciated.
Good Quality for your Qt, this is pretty "rare" on this Forum for 'iMacros' Qt's... (+1 from me...)
Like mentioned/explained in your parallel Thread on the iMacros Forum:
https://forum.imacros.net/viewtopic.php?f=11&t=30705&p=84161#p84154
=> I think you are hitting a Bug actually, but that's not "really" the Functionality that you want...
(The Thread on the iMacros Forum contains more Info, I'm only posting a "simplified"/shortened Answer on this Forum...)
In order to paste the Content of the 'EXTRACT', you need to use the '{{!EXTRACT}}' Command (and not '{{!CLIPBOARD}}' like you are currently doing)...
And if you do several 'C&P' in your Script, you each time need to reset the '!EXTRACT' Built-in Var before each 'EXTRACT':
VERSION BUILD=10021450
FRAME F=12
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=A ATTR=ID:msku-attribute-add
TAG POS=1 TYPE=INPUT:CHECKBOX ATTR=ID:msku-own-parent-tag-checkbox CONTENT=YES
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-parent-attribute-input CONTENT=Sticker<SP>Size
TAG POS=1 TYPE=BUTTON ATTR=ID:msku-add-parent-tag-btn
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-link
TAB T=2
FRAME F=0
SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivsml EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
TAB T=2
FRAME F=0
SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=ID:resultsdivstd EXTRACT=TXT
TAB T=1
FRAME F=12
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:msku-custom-option-input CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=A ATTR=ID:msku-custom-option-add
... etc...
Grrr..., and this Site is Buggy again, the Toolbar with all Formatting Icons (Bold/Italic/Code/etc...) has now kind of disappeared and is just Blank...! (PM v26.3.3) => I have to use a different Browser (FF v55.0.3) to be able to post this Answer...

IMacros If then else statement how to?

I am trying to make a script to automatically skip males and couples on a chat site, when i reach a couple the class is gndr_couple and the script returns an error and stops.
This is my current code:
VERSION BUILD=844 RECORDER=CR
FRAME F=1
WAIT SECONDS=0.5
TAG POS=1 TYPE=DIV ATTR=CLASS:gndr_male
WAIT SECONDS=0.2
TAG POS=1 TYPE=BUTTON ATTR=ID:right_button

unable to paste content on yahoo body using iMacros

i have a piece of imacros code for sending out Yahoo eMails which works great. But except for pasting content in the body field. I have tried a few other methods using imacros, but i can't get this part to work.
Here is my code. Appreciate any help. :)
VERSION BUILD=844 RECORDER=CR
SET EMAIL "test#test.com"
SET PASS "password"
SET !ERRORIGNORE YES
URL GOTO=https://login.yahoo.com/?.src=ym&.intl=us&.lang=en-US&.done=https%3a//mail.yahoo.com
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:mbr-login-form ATTR=ID:login-username CONTENT={{EMAIL}}
TAG POS=1 TYPE=BUTTON FORM=ID:mbr-login-form ATTR=ID:login-signin
SET !ENCRYPTION NO
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:mbr-login-form ATTR=ID:login-passwd CONTENT={{PASS}}
TAG POS=1 TYPE=BUTTON FORM=ID:mbr-login-form ATTR=ID:login-signin
WAIT SECONDS=3
TAG POS=1 TYPE=SPAN ATTR=ID:yui_3_16_0_ym19_1_*
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:to-field CONTENT=test#gmail.com
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:subject-field CONTENT=test
TAG POS=1 TYPE=DIV ATTR=ID:rtetext
TAG POS=5 TYPE=SPAN ATTR=ID:yui_3_16_0_ym19_1_*
Have you tried using the Event recording mode (iMacros Sidebar - Manage Tab - Settings) for entering the message body? I tried a quick recording myself and found that the following two commands together were successful in filling the message body:
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(9)>DIV:nth-of-type(3)>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV:nth-of-type(7)>DIV>TABLE>TBODY>TR:nth-of-type(2)>TD>DIV>DIV>DIV:nth-of-type(2)" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>DIV:nth-of-type(9)>DIV:nth-of-type(3)>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV:nth-of-type(7)>DIV>TABLE>TBODY>TR:nth-of-type(2)>TD>DIV>DIV>DIV:nth-of-type(2)" CHARS="this is a test"

iMacro - Firefox - OnDownload not working?

I'm using the last version of iMacro and of Firefox.
I'm trying to run it so it downloads a .csv into a specific folder on a different drive that's on the network which it does have access to, the machine that is.
However, every time I see to download it, it does it in the default folder.
Now I did change the download folder but, since I need iMacro to also rename it it just won't cut it exactly.
Here's the code. Now I know I inserted a comment in there, I was playing around to make it work.
Thank you.
VERSION BUILD=8890130 RECORDER=FX
TAB T=1
URL GOTO=WEBSITE
FRAME F=1
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:username CONTENT=USERNAME
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD ATTR=NAME:password CONTENT=PASSWORD
TAG POS=1 TYPE=BUTTON ATTR=TXT:LOG<SP>IN
URL GOTO=WEBSITE
WAIT SECONDS=15
TAG POS=1 TYPE=DIV ATTR=ID:ext-gen1194
TAG POS=1 TYPE=A ATTR=TXT:Today
TAG POS=1 TYPE=SPAN ATTR=ID:button-1030-btnInnerEl
WAIT SECONDS=10
ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd}}.csv WAIT=YES
'ONDOWNLOAD FOLDER="\\\\DifferentServer\\path\\path\\path\\path\\path\\" FILE=+{{!NOW:yyyymmdd}}.csv WAIT=YES
WAIT SECONDS=10
TAG POS=1 TYPE=SPAN ATTR=ID:button-1055-btnIconEl
WAIT SECONDS=10
TAB CLOSEALLOTHERS
TAB T=1
TAB CLOSE

iMacros .if .else captcha

Good afternoon! I've a code with bypass captcha service written in iMacros.My problem is..
I need to do that if my captcha is incorrect then to do it again like a loop or if captcha is good then go next part of code.
How can i do that in iMacros.I heard about javascript there but can't make up code.
Please, look at my code.
URL GOTO="my site"
TAG POS=1 TYPE=DIV ATTR=TXT:"my options"
TAG POS=1 TYPE=INPUT:RADIO ATTR=ID:"my options"
wait seconds=2
SET !EXTRACT_TEST_POPUP NO
ONDOWNLOAD FOLDER=C:\Captcha\ FILE=image.jpg WAIT=YES
TAG POS=1 TYPE=IMG ATTR=SRC:"image captcha" CONTENT=EVENT:SAVEPICTUREAS
tab open
tab t=2
URL GOTO="service captcha"
TAG POS=1 TYPE=INPUT ATTR=NAME:pict CONTENT=C:\Captcha\image.jpg
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:"submit send captcha"
ATTR=VALUE:Send
TAG POS=6 TYPE=TD ATTR=* EXTRACT=TXT
wait seconds=3
SET !VAR1 {{!EXTRACT}}
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:account ATTR=ID:Passwd CONTENT="my password"
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:account ATTR=ID:PasswdAgain CONTENT="my
password"
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:account ATTR=ID:Email CONTENT="email"
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:account ATTR=ID:newaccountcaptcha CONTENT={{!var1}}
wait seconds=2
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:account ATTR=ID:submitbutton
Ok.Some times captcha is incorrect in form and it gives me one message like that
" The characters you entered are wrong " .How can i repeat these steps again with javascript?
I'm only interested in the preventive methods cauze iMacros is interesting analog then other programs.
Thanks you guys.
You have an example here how you can use JavaScript Scripting and make nested loops.
Nested loop in iMacros (2nd loop)