storeNamedCookie

What is it?

This extension adds store, assert and verify methods for named (individual) cookies, either their presence or their value. Similar to storeCookie, assertCookie, verifyCookie but specific to an individual cookie rather than the entire cookie string. See bug 453 for more information about why this is useful.

The extension is used to test the Springer website by Aptivate for HINARI.

Licence

Apache License, V2. This code was developed by Chris Wilson for Aptivate.

How to add it to selenium:

1. Download the attachment and append its contents to your 'user-extensions.js' file.

Example code:

Please note that this example accesses an external website, so that part of the example will only work in Selenium IDE, or Selenium RC chrome mode.

createCookie a=1  
createCookie b=2  
assertCookie regex:a=1; b=2  
assertNamedCookie a 1
assertNamedCookie b 2
assertNotNamedCookie c  
assertNotNamedCookie a 2
assertNotNamedCookie a=2  
assertNotNamedCookie b=  
assertHaveCookie a  
assertHaveCookie b  
assertNotHaveCookie c  
assertNotHaveCookie a=1  
assertNotHaveCookie a=  
open http://www.springerlink.com/content/p0g31780231k5600/  
deleteCookie SelectedPrimitives /
open http://www.springerlink.com/content/p0g31780231k5600/  
assertNotHaveCookie SelectedPrimitives  
assertTextPresent Marked Items  
assertTextNotPresent Marked Items (  
click //td[3]/div[1]/a/span  
assertTextPresent Marked Items (1)  
assertNamedCookie SelectedPrimitives %2C%27p0g31780231k5600%27
open http://www.springerlink.com/content/e2h3726403451862/  
assertTextPresent Marked Items (1)  
assertNamedCookie SelectedPrimitives %2c'p0g31780231k5600'
click //td[3]/div[1]/a/span  
assertTextPresent Marked Items (2)  
assertNamedCookie SelectedPrimitives %2C%27p0g31780231k5600%27%2C%27e2h3726403451862%27
click //td[3]/div[1]/a/span  
assertTextPresent Marked Items (1)  
assertNamedCookie SelectedPrimitives %2C%27p0g31780231k5600%27
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.