iMacros: form filling THEN extracting the results - forms

I've searched through previous questions but can't seem to find the advice I'm looking for.
I'm currently testing a quote engine in a web based testing environment, which involves filling in different criteria (Location, Age, Dates), pressing submit and then being presented with the results in a table.
It's taking FOREVER, so I'm trying to automate the process in iMacros.
I've successfully setup a macro to pull out the criteria I need in the form from a csv file and fill the form, but now I need to extract the data for each time the form 'fills' itself.
Is this actually possible?
Here's my code so far....
TAB T=1
SET !DATASOURCE returndates.csv
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO=XXXX/TravelQuotation
TAG POS=1 TYPE=SELECT FORM=ACTION:TravelQuotation/RetrieveQuotes ATTR=ID:Aggregator CONTENT=%engine1
TAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:TravelQuotation/RetrieveQuotes ATTR=ID:TripType
TAG POS=1 TYPE=SELECT FORM=ACTION:TravelQuotation/RetrieveQuotes ATTR=ID:TripArea CONTENT=%2
TAG POS=1 TYPE=DIV ATTR=TXT:--<SP>Select<SP>One<SP>--
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:TravelQuotation/RetrieveQuotes ATTR=ID:StartDate CONTENT=01/03/2014
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:TravelQuotation/RetrieveQuotes ATTR=ID:EndDate CONTENT=02/03/2014
TAG POS=1 TYPE=INPUT:RADIO FORM=ACTION:TravelQuotation/RetrieveQuotes ATTR=ID:GroupType
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:TravelQuotation/RetrieveQuotes ATTR=ID:FirstName CONTENT=John
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:TravelQuotation/RetrieveQuotes ATTR=ID:LastName CONTENT=Smith
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:TravelQuotation/RetrieveQuotes ATTR=ID:Email CONTENT=john.smith#smithjob.com
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:TravelQuotation/RetrieveQuotes ATTR=ID:PrimaryTravellerDOB CONTENT=30/03/1965
TAG POS=9 TYPE=DIV ATTR=TXT:
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:TravelQuotation/RetrieveQuotes ATTR=*
TAG POS=1 TYPE=TABLE ATTR=TXT:Product<SP>Name<SP>Product<SP>Type<SP>Max<SP>Days<SP>Premium* EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=* FILE=TEST1.csv
Any help is much appreciated!

possible.
Use EXTRACT command
Here is the link:
http://wiki.imacros.net/Data_Extraction

Related

How can I extract the URL session ID and replace the Old one with iMacros

First Thank you for this Community, I'm new here and I'll like to help everyone if I can.
I hope that is sufficiently well explained:
I log into a webpage and I get a random ID (Example) 8888888888:
http://whatever/index.php?page=overview&session=8888888888
I need to grab the random session ID: 8888888888 becouse every login I have a NEW ID and I want to REPLACE the OLD one in the macro code. ( maybe with a VAR ? )
Example:
First, I'll Log in, I get the random ID.
Random ID example:
http://whatever/index.php?page=overview&session=8888888888
Ok, now I run this macro:
SET !VAR1 {{!URLCURRENT}}
TAB T=1
URL GOTO={{!VAR1}}
Now I need to
GET session ID: 8888888888 and need to replace the OLD login ID: XXXX in the rest of the macro, so I don't have to write it manually for the macro to run, every time I log in again with the new ID.
TAG POS=1 TYPE=A ATTR=TXT:Fleet
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:index.php?page=flotten2&session=XXXX ATTR=NAME:ship210 CONTENT=41
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:index.php?page=flotten2&session=XXXX ATTR=VALUE:continue
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:index.php?page=flotten3&session=XXXX ATTR=NAME:system CONTENT=191
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:index.php?page=flotten3&session=XXXX ATTR=NAME:planet CONTENT=5
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:index.php?page=flotten3&session=XXXX ATTR=VALUE:continue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:index.php?page=flottenversand&session=XXXX ATTR=VALUE:continue
WAIT SECONDS=190
So It will look like this automatically every login with the new ID:
TAG POS=1 TYPE=A ATTR=TXT:Fleet
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:index.php?page=flotten2&session=8888888888 ATTR=NAME:ship210 CONTENT=41
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:index.php?page=flotten2&session=8888888888 ATTR=VALUE:continue
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:index.php?page=flotten3&session=8888888888 ATTR=NAME:system CONTENT=191
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:index.php?page=flotten3&session=8888888888 ATTR=NAME:planet CONTENT=5
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:index.php?page=flotten3&session=8888888888 ATTR=VALUE:continue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:index.php?page=flottenversand&session=8888888888 ATTR=VALUE:continue
WAIT SECONDS=190
Actually, I'm replacing the old id with the new one Manually... so I'm starting to get bored :D
Thank you in advance and ask me if you have any comments.
Try in this way:
SET !VAR1 {{!URLCURRENT}}
TAB T=1
URL GOTO={{!VAR1}}
SET id EVAL("'{{!URLCURRENT}}'.match(/session=(\w+)/)[1];")
TAG POS=1 TYPE=A ATTR=TXT:Fleet
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:index.php?page=flotten2&session={{id}} ATTR=NAME:ship210 CONTENT=41
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:index.php?page=flotten2&session={{id}} ATTR=VALUE:continue
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:index.php?page=flotten3&session={{id}} ATTR=NAME:system CONTENT=191
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:index.php?page=flotten3&session={{id}} ATTR=NAME:planet CONTENT=5
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:index.php?page=flotten3&session={{id}} ATTR=VALUE:continue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:index.php?page=flottenversand&session={{id}} ATTR=VALUE:continue
WAIT SECONDS=190

imacros can't write in text field facebook

HELP PLEASEEEE....
:( :( :(
i'm trying to make imacros code for input product at facebook shop in facebook page.
it didn't want to write anything at product title, price and description field.
error picture
my code is:
VERSION BUILD=8970419 RECORDER=FX
TAB T=1
SET !REPLAYSPEED FAST
SET !ERRORIGNORE YES
SET !TIMEOUT_STEP 0
SET !EXTRACT_TEST_POPUP NO
SET !DATASOURCE 1.csv
SET !LOOP 3
WAIT SECONDS=1
URL GOTO=https://www.facebook.com/mine/shop#
TAG POS=1 TYPE=DIV ATTR=CLASS:_5tqv&&TXT:
WAIT SECONDS=1
TAG POS=3 TYPE=DIV ATTR=TXT:Add<SP>Photos
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:FILE ATTR=* CONTENT=C:\{{!COL2}}
WAIT SECONDS=3
TAG POS=3 TYPE=DIV ATTR=TXT:Add<SP>Photos
WAIT SECONDS=3
TAG POS=1 TYPE=INPUT:FILE ATTR=* CONTENT=C:\{{!COL28}}
WAIT SECONDS=10
TAG POS=1 TYPE=BUTTON ATTR=TXT:Use<SP>Photos<SP>(2)
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:TEXT ATTR=TYPE:text&&CLASS:_58al&&PLACEHOLDER:Name&&NAME:productTitle&&MAXLENGTH:80 CONTENT={{!COL1}}
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:TEXT ATTR=CLASS:_4b7k<SP>_4b7k_atlas&&PLACEHOLDER:0 CONTENT={{!COL4}}
WAIT SECONDS=1
TAG POS=1 TYPE=TEXTAREA ATTR=CLASS:_58an&&ROWS:3&&PLACEHOLDER:Description<SP>(Optional)&&NAME:productDescription CONTENT={{!COL1}}<BR><BR>Warna:<SP>{{!COL7}}<BR>Bahan:<SP>{{!COL8}}<BR>Size:<SP>{{!COL9}}<BR>Sol:<SP>{{!COL10}}<BR>{{!COL11}}<BR><BR>Harga:<SP>{{!COL4}}<BR><BR>{{!COL26}}<BR><BR>{{!COL13}}
TAG POS=1 TYPE=A ATTR=TXT:Save
WAIT SECONDS=3
REFRESH
Thank youuuu so muchh before...

Imacro uploading image

I am trying to upload an image to URL GOTO=http://www.kijiji.ca/p-post-ad.html?categoryId=696 this website.
VERSION BUILD=8340723 RECORDER=CR
SET !TIMEOUT_PAGE 10
SET !ERRORIGNORE YES
TAB T=1
TAB CLOSEALLOTHERS
SET !DATASOURCE bp.csv
SET !DATASOURCE_COLUMNS 6
SET !LOOP 4
SET !DATASOURCE_LINE {{!LOOP}}
WAIT SECONDS=5
URL GOTO=http://www.kijiji.ca/p-post-ad.html?categoryId=696
WAIT SECONDS=5
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:PostAdMainForm ATTR=ID:priceAmount CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:PostAdMainForm ATTR=ID:postad-title CONTENT={{!COL3}}
TAG POS=2 TYPE=INPUT:RADIO FORM=ID:PostAdMainForm ATTR=ID:forsaleby_s
TAG POS=1 TYPE=TEXTAREA FORM=ID:PostAdMainForm ATTR=ID:pstad-descrptn CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:PostAdMainForm ATTR=ID:pstad-map-address CONTENT={{!COL5}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:PostAdMainForm ATTR=ID:PhoneNumber CONTENT={{!COL6}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:PostAdMainForm ATTR=ID:YoutubeURL CONTENT=https://www.youtube.com/watch?v=t6dTrQVzgio
TAG POS=1 TYPE=BUTTON FORM=ID:PostAdMainForm ATTR=ID:ImageUploadButton
TAG POS=1 TYPE=INPUT:FILE FORM=ID:PostAdMainForm ATTR=ID:ImageUpload CONTENT=C:\fakepath\GDT650SGFBB.jpg
WAIT SECONDS=20
TAG POS=1 TYPE=BUTTON FORM=ID:PostAdMainForm ATTR=NAME:saveAndCheckout
WAIT SECONDS=5
When I tried uploading and recording the macro in, it gives me ATTR=ID:html5_fasdfsadfas <- code .
Could you help me out please.
Thank you
iMacro version 9 is not supporting Upload functionality kindly try to donwload version 8.9.7 of iMacro then your script will work fine there is no any bug in the script.

iMacros Multipage Loop Extraction

I am using iMacros v9.00.2379. WHat I am currently trying to achieve is to go onto a product page, scrap the title, additional information, image (if possible) and description. The browser then goes back and repeats the process for pages structured in the exact same way. So far I have tried;
VERSION BUILD=7401598
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.amazon.com/gp/bestsellers/books/2020/ref=s9_dnav_bw_ir11_z? pf_rd_m=ATVPDKIKX0DER&pf_rd_s=merchandised-search- 4&pf_rd_r=08RVC6ADSMV3711JH9VS&pf_rd_t=101&pf_rd_p=1759594182&pf_rd_i=1
TAG POS={{!loop}} TYPE=TD FORM=ID:form1 ATTR=TXT:*
TAG POS=8 TYPE=TD FORM=ID:form1 ATTR=TXT:* EXTRACT=TXT
TAG POS=6 TYPE=TD FORM=ID:form1 ATTR=TXT:* EXTRACT=TXT
TAG POS=20 TYPE=TD FORM=ID:form1 ATTR=TXT:* EXTRACT=TXT
TAG POS=24 TYPE=TD FORM=ID:form1 ATTR=TXT:* EXTRACT=TXT
TAG POS=22 TYPE=TD FORM=ID:form1 ATTR=TXT:* EXTRACT=TXT
TAG POS=34 TYPE=TD FORM=ID:form1 ATTR=TXT:* EXTRACT=TXT
TAG POS=38 TYPE=TD FORM=ID:form1 ATTR=TXT:* EXTRACT=TXT
TAG POS=42 TYPE=TD FORM=ID:form1 ATTR=TXT:* EXTRACT=TXT
TAG POS=46 TYPE=TD FORM=ID:form1 ATTR=TXT:* EXTRACT=TXT
TAG POS=66 TYPE=TD FORM=ID:form1 ATTR=CLASS:labelBold EXTRACT=TXT
SAVEAS TYPE=EXTRACT FOLDER=C:\iMacrosExports\ FILE=Extract_{{!NOW:ddmmyy_hhnnss}}.csv
WAIT SECONDS=2
BACK
The site in question is http://www.bookdepository.com but today it's down.
This worked fine for me.
"websiteloop" in last line is your above code which will extract the data from the links.
Links you should provide in "var urls" section as I did it with "www.ab.com/first.html" "www.ba.com/second.html" etc...
Script:
var urls =
['http://www.ab.com/first.html',
'http://www.ba.com/second.html
etc....']
for (var i in urls) {
var url = urls[i];
var returnCode = iimPlay('CODE: URL GOTO='+url);
iimPlay("C:\\Users\\venkat\\Documents\\iMacros\\Macros\\#websiteloop");
}

iMacross script delete photos one by one

this iMacross script i want to use in facebook.
i want to create iMacross script that will click "Delete this photo" link, wait a second until a dialog box appear and will click "confirm" button.
this is my script so far :
VERSION BUILD=8820413 RECORDER=FX
TAB T=1
SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 1
SET !TIMEOUT_STEP 1
TAG POS=1 ATTR=TXT:Delete this photo
WAIT SECONDS=3
TAG TYPE=INPUT:BUTTON ATTR=NAME:confirm
WAIT SECONDS=3
but it not works and keep appear error :
SyntaxError: wrong format of TAG command, line 6 (Error code: -910)
can anyone help?
UPDATE
The worked code is here for deleting photos in not theater mode. :
VERSION BUILD=8820413 RECORDER=FX
TAB T=1
WAIT SECONDS=3
TAG POS=1 TYPE=A ATTR=TXT:"Delete this photo"
WAIT SECONDS=3
TAG POS=1 TYPE=BUTTON ATTR=TXT:"Confirm"
WAIT SECONDS=5
The problem is with TAG POS=1 ATTR=TXT:Delete this photo because the innerHTML (TXT for iMacros) contains Blank spaces to solve this you have 2 options
#1
replace each blank space with <SP> in your TXT attribute:
TAG POS=1 TYPE=A ATTR=TXT:Delete<SP>This<SP>Photo
#2
enclose your TXT within double-quotes:
TAG POS=1 TYPE=A ATTR=TXT:"Delete This Photo"
Both solutions works, Here's what I have tested
VERSION BUILD=8820413 RECORDER=FX
TAB T=1
URL GOTO=https://www.facebook.com/photo.php?fbid={ID}
TAG POS=1 TYPE=A ATTR=TXT:"Delete This Photo"
WAIT SECONDS=3
TAG POS=1 TYPE=BUTTON ATTR=TXT:Confirm
UPDATE
To delete the photo in Facebook "theater" mode, we need to open the photo permalink then initiate the "theater" mode using TAG POS=1 TYPE=A ATTR=TXT:"Open Photo Viewer"
VERSION BUILD=8820413 RECORDER=FX
TAB T=1
URL GOTO=https://www.facebook.com/photo.php?fbid=162982897217166
TAG POS=1 TYPE=A ATTR=TXT:"Open Photo Viewer"
WAIT SECONDS= 5
TAG POS=1 TYPE=SPAN ATTR=TXT:Options
TAG POS=2 TYPE=SPAN ATTR=TXT:"Delete This Photo"
TAG POS=1 TYPE=BUTTON ATTR=TXT:Confirm
Further Reading:
TAG - iMacros Wiki