Delete Cookies, history and cache of specific web pages?

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Dimar
Posts: 17
Joined: Fri May 01, 2015 2:57 am

Delete Cookies, history and cache of specific web pages?

Post by Dimar » Sat May 09, 2015 2:27 am

I ask: How IMACRO you can delete cookies, history and cache of specific web pages of a Firefox or Chrome browser?

I use this string of code to remove cookies:

CLEAR
SET !FILESTOPWATCH mydata.csv
STOPWATCH ID=total

But I quisiero not delete all cookies just some specific pages.

It is possible with IMACRO? or some other way?

Thank you very much for support!
chivracq
Posts: 9823
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Delete Cookies, history and cache of specific web pages?

Post by chivracq » Sat May 09, 2015 5:31 pm

Dimar wrote:I ask: How IMACRO you can delete cookies, history and cache of specific web pages of a Firefox or Chrome browser?

I use this string of code to remove cookies:

Code: Select all

CLEAR
SET !FILESTOPWATCH mydata.csv
STOPWATCH ID=total
But I quisiero not delete all cookies just some specific pages.

It is possible with IMACRO? or some other way?

Thank you very much for support!
FCIM...! :mrgreen: (I only answer Threads when FCI is mentioned... (like you did perfectly in your previous Thread...))

And "quisiero" doesn't sound very English, or I don't know what it means...?
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Dimar
Posts: 17
Joined: Fri May 01, 2015 2:57 am

Re: Delete Cookies, history and cache of specific web pages?

Post by Dimar » Sat May 09, 2015 7:13 pm

Hello chivracq

Sorry, you're right, I had forgotten to put the FCIM. I try to write the best English so they can understand me and helped me with a translator, so the word "quisiero" which in itself was misspelled that word should have said "would" :D

This is what I meant: But I would not delete all cookies just some specific pages.

FCIM:

IMACRO: 8.9.2
Browser: Firefox 37.0.2
OS: W7

Thank you very much!
chivracq
Posts: 9823
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Delete Cookies, history and cache of specific web pages?

Post by chivracq » Sat May 09, 2015 8:25 pm

Dimar wrote:Hello chivracq

Sorry, you're right, I had forgotten to put the FCIM. I try to write the best English so they can understand me and helped me with a translator, so the word "quisiero" which in itself was misspelled that word should have said "would" :D

This is what I meant: But I would not delete all cookies just some specific pages.

FCIM:

IMACRO: 8.9.2
Browser: Firefox 37.0.2
OS: W7

Thank you very much!
OK for FCI (Full Config Info), and the M stands for "Missing"...

OKay, for your Question, it's not possible in pure .iim to make some Conditional Commands, like say, compute a String called "CLEAR" using 'EVAL()' and try to run that Command using the Variable, I've tried, it doesn't work:

Code: Select all

SET MyCommand "REFRESH"
{{MyCommand}}
will trigger the following RuntimeError:
SyntaxError: can not parse macro line: {{MyCommand}}[ (Error code: -910)
I see 3 ways of doing what you want...

Method 1:
What you want is Conditional Behaviour, and Conditional Behaviour is normally achieved using a Main .js Script in which all the Conditional Logic will be placed and which calls your different .iim Scripts. It is even probably possible to trigger the 'CLEAR' directly from JavaScript, but the Behaviour might be a bit different from an iMacros 'CLEAR'...

Method 2:
As it is probably possible to trigger a 'CLEAR' from JavaScript, you could compute this JavaScript Statement as a String using 'EVAL()' and you run it in your .iim Macro with:

Code: Select all

URL GOTO=javascript:{{MyCommand}}
I think I had tried it in some Thread about closing the Browser and that it works...

Method 3:
You split your .iim Macro into 2 Macros ('Part1.iim' and 'Part2.iim') and you can put the 'CLEAR' Command in some mini .iim Macro ('ClearCookies.iim') that you will call from 'Part1.iim' Macro using the Syntax that you already use from your previous Thread:

Code: Select all

URL GOTO=imacros://run/?m=ClearCookies.iim
and 'ClearCookies.iim' in return will call 'Part2.iim:

Code: Select all

CLEAR
URL GOTO=imacros://run/?m=Part2.iim
and in 'Part1.iim', you compute the Name of 'ClearCookies.iim' as a String (or an empty String if no 'CLEAR' is needed, or the Name of 'Part2.iim') using 'EVAL()', based on '!URLCURRENT' or whatever Condition you want to use like:

Code: Select all

SET !ERRORIGNORE YES
SET My_URL_to_clear_Cookies "http://www.yourURL.com"
SET ClearCookies EVAL("var uc='{{!URLCURRENT}}'; var mu='{{My_URL_to_clear_Cookies}}'; var x; if(uc==mu}{x='ClearCookies.iim';} else {x='';}; x;")
URL GOTO=imacros://run/?m={{ClearCookies}}
(Not tested..., but I use a similar Solution in one of my Macros and 'URL GOTO=imacros://run/?m=' does nothing on an empty String...)
But this Method might be a bit cumbersome depending on how generic is what you do in 'Part2.iim', otherwise you will need 1 different 'ClearCookies.iim' for each (with different Names...) and as well if the List of URL's for which the Clear is needed is long...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Dimar
Posts: 17
Joined: Fri May 01, 2015 2:57 am

Re: Delete Cookies, history and cache of specific web pages?

Post by Dimar » Sat May 09, 2015 11:12 pm

Thanks for the support.

Is Windows 7 :)

Method 1: My knowledge is limited in Script. :(

Method 2: the same

Method 3: Do not quite understand what it does, apologize.

What I seek is not delete cookies from a particular web page (as this then will ask to enter captcha, to login), but if you delete cookies from all other web pages.

I found this Firefox add: CookiesKeeper, what it does is protect cookies from one or more web pages and remove cookies all others, but this would have to do it manually.
chivracq
Posts: 9823
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Delete Cookies, history and cache of specific web pages?

Post by chivracq » Sun May 10, 2015 12:33 am

Dimar wrote:Thanks for the support.

Is Windows 7 :)

Method 1: My knowledge is limited in Script. :(

Method 2: the same

Method 3: Do not quite understand what it does, apologize.

What I seek is not delete cookies from a particular web page (as this then will ask to enter captcha, to login), but if you delete cookies from all other web pages.

I found this Firefox add: CookiesKeeper, what it does is protect cookies from one or more web pages and remove cookies all others, but this would have to do it manually.
Ah OK..., but your Thread Title said "Delete Cookies... of specific Web-Pages", not "Delete all Cookies except for specific Web-Pages"...!
Then iMacros 'CLEAR' Command will delete all Cookies indeed, unless you've protected them using some other means, this CookieKeeper Add-on (and not "CookiesKeeper") looks promising indeed, but I will only install it tomorrow, I have some unattended scheduled Scripts running in the night, I don't want CK to mess anything up..., even if the Add-on has good Reviews and the Programmer looks very good and responsive... But what I understood is that you only have to configure CK once...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Dimar
Posts: 17
Joined: Fri May 01, 2015 2:57 am

Re: Delete Cookies, history and cache of specific web pages?

Post by Dimar » Sun May 10, 2015 2:14 am

Sorry, I thought that made me understand.

What happens is that CookieKeeper, protect the Cookies you want, as long as, deleting cookies is done through CK.

By using "CLEAR" using IMACRO, CK makes no protection.
Post Reply