You mean to erase all the history, cookies, localStorage, stored passwords, and everything on the browser? I don't think you have the privilege to do that for all websites. You might have the ability to do it on your OWN website but not for other sites.

You can erase the cookies and the localStorage by adding the following code into the HTML output of your script:

<SCRIPT> <!-- function EraseEverything() { function DeleteCookie(NAME) { document.cookie = NAME + "=;Expires=Th +u, 01 Jan 1970 00:00:01 GMT"; } function DeleteAllCookies() { var i, s, e, X, K = document.cookie.sp +lit(";"); for (i = 0; i < K.length; i++) { e = K[i].indexOf("="); if +(e < 0) X = ""; else { for (s = 0; K[i].charCodeAt(s) < 33; s++); X = + K[i].substring(s, e); } DeleteCookie(X); } } DeleteAllCookies(); // Empty localStorage: var SUCCESS = 0; try { localStorage.clear(); SUCCESS = 1; } catch (e) {} var storage_cleared = new Image(); storage_cleared.src = "http://www.mywebsite.com/erased.pl?s=" + SUCC +ESS + "&url=" + escape(location.href); } EraseEverything(); --> </SCRIPT> <NOSCRIPT><IMG STYLE="POSITION:ABSOLUTE; TOP:0; LEFT:0;" BORDER=0 WIDT +H=1 HEIGHT=1 SRC="http://www.mywebsite.com/erased.pl?s=2"></NOSCRIPT>

Note: This JavaScript will give feedback to your perl script to let you know whether or not the localStorage has been erased. (Some browsers do not support this feature. And sometimes JavaScript is entirely disabled in the browser. In that case, you get a different errorcode back. So, you know exactly what's going on.

There is also a file system and a database system feature, but these are not supported by most browsers, and I am not familiar with how they operate. Most websites use cookies and localStorage, because these two are supported by nearly every web browser out there.

I do not know how to erase the form history, passwords, and history from the browser. You could tie the form names to the current time, so that way every second when the user refreshes the page, the form data gets written into a different temporary name, and it's never the same. So, the user will never see the previous suggestions in the browser. Example:

<SCRIPT> <!-- NOW = (new Date()).getTime(); document.write("<FORM NAME=MAIN METHOD=POST ACTION='http://www.mywebsi +te.com/getname.cgi'>Please enter your first name: <INPUT TYPE=TEXT SI +ZE=20 NAME=FIRSTNAME" + NOW + "> <INPUT TYPE=SUBMIT></FORM>"); --> </SCRIPT>

The browser remembers the form values based on their name, but if the name changes every time, then it won't show any suggestions ever.


In reply to Re: Browser cache with Selenium::Remote::Driver by harangzsolt33
in thread Browser cache with Selenium::Remote::Driver by Perlchaoui

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.