1

I am doing an exercise to search a solicitor, then access her profile, then log out. I would like to clear the browser cache or the cookies, so when I run the script in a continuous pattern, it will act like start from the beginning.

It doesn't seems to work. Please give me some advise on how to modify my script so I can delete the cookies.

The error message showed in the Selenium IDE log section:

[error] Element id=edit-name not found

  1. For example, for cookie _utma, the value for expires changed from 7/10/2015 9:24pm to 7/11/2015 9:24pm, I am not sure if this means the cookie being deleted successfully OR the value changes due to execution of the script.
  2. what is the correct syntax for deleCookie command in Selenium Here are the syntax I used

deleteCookie > "path=/",domain=".jlaustin.tcheetah.com","recurse=true"

OR deleteCookie >"path=/,domain=.jlaustin.tcheetah.com,recurse=true"

  1. I would like to know what is the difference between a domain and a host From My Firefox browser, the view cookie section show the value for the cookie agent and the cookie *_utma*

    table view of the script, screenshot1 , screenshot2

Here is the script generated by Selenium IDE (version 1.10.0)

<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">search_solicitor</td></tr>
</thead><tbody>
<tr>
    <td>setSpeed</td>
    <td>5000</td>
    <td></td>
</tr>
<tr>
    <td>deleteCookie</td>
    <td>agent</td>
    <td>&quot;path=/&quot;, domain=&quot;.jlaustin.tcheetah.com,&quot; recurse=true&quot;</td>
</tr>
<tr>
    <td>deleteCookie</td>
    <td>user</td>
    <td>&quot;path=/&quot;,domain=&quot;.jlaustin.tcheetah.com&quot;,&quot;recurse=true&quot;</td>
</tr>
<tr>
    <td>deleteCookie</td>
    <td>uweopenid</td>
    <td>&quot;path=/&quot;,domain=&quot;.jlaustin.tcheetah.com&quot;,&quot;recurse=true&quot;</td>
</tr>
<tr>
    <td>deleteCookie</td>
    <td>_utma</td>
    <td>&quot;path=/&quot;,domain=&quot;.jlaustin.tcheetah.com&quot;,&quot;recurse=true&quot;</td>
</tr>
<tr>
    <td>deleteAllVisibleCookies</td>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>open</td>
    <td>/?html=openid&amp;logout=1</td>
    <td></td>
</tr>
<tr>
    <td>pause</td>
    <td>6000</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>css=input[type=&quot;submit&quot;]</td>
    <td></td>
</tr>
<tr>
    <td>pause</td>
    <td>5000</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=edit-name</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>id=edit-pass</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>name=autologin</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>id=edit-submit</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>id=cmp_admin</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>link=Donor</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>link=manage solicitors</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>link=Baldwin, Donna</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>css=span.systemsmallbold &gt; a</td>
    <td></td>
</tr>
<tr>
    <td>deleteAllVisibleCookies</td>
    <td></td>
    <td></td>
</tr>
</tbody></table>
user2061466
  • 485
  • 9
  • 17
  • 27
  • @Ankit jain, can your guys take a look at this post and give me some advises regards to how to delete or clear cache using Selenium IDE. Or Shall I write separate code to clear the browser cache? – user2061466 Jul 14 '13 at 19:23
  • @Anders Lindahl, could you take a look at this post and give me some advises regards to how to delete or clear cache using Selenium IDE. Or Shall I write separate code to clear the browser cache? – user2061466 Jul 14 '13 at 19:24
  • @Cedric Beust, Could you take a look at this post and give me some advises regards to how to delete or clear cache using Selenium IDE. Or Shall I write separate code to clear the browser cache – user2061466 Jul 14 '13 at 19:24
  • @hr_117, Could you take a look at this post and give me some advises regards to how to delete or clear cache using Selenium IDE. Or Shall I write separate code to clear the browser cache – user2061466 Jul 14 '13 at 19:25
  • @@Engineer Dollery, Could you take a look at this post and give me some advises regards to how to delete or clear cache using Selenium IDE. Or Shall I write separate code to clear the browser cache – user2061466 Jul 14 '13 at 19:26
  • @HemChe, Could you take a look at this post and give me some advises regards to how to delete or clear cache using Selenium IDE. Or Shall I write separate code to clear the browser cache – user2061466 Jul 14 '13 at 19:26

1 Answers1

0

You can launch javascript functions within selenium IDE such as :

<tr>
    <td>storeEval</td>
    <td>(function() {return "HeLLO";})</td>
    <td>returnedVal</td>
</tr>

You can therefore launch a JS function do del a cookie with a function like that Clearing only specific cookies

function deleteCookie(c_name) {
    document.cookie = encodeURIComponent(c_name) + "=deleted; expires=" + new Date(0).toUTCString();
}

and customize this with your need.

I have never used buildin function for del cookies as I want to control what exactly I delete.

Community
  • 1
  • 1
aorfevre
  • 5,034
  • 3
  • 21
  • 51
  • concerning your error : [error] Element id=edit-name not found , this is, in my opinion, not linked to Cookies. selenium is looking for an object called : edit-name that does not exists in your page. – aorfevre Jun 10 '14 at 18:54