Marco wrote on 09/01/2005 06:02:20 AM:
> Is it possible to manipulate cookies in selenium?
>
> I would like to be able to reset them at the end of a test, so that
> next one will run as if they have never been set.


Selenium lives in the same security sandbox as any other _javascript_ code... Which means _javascript_ can manipulate cookies, but only those cookies for the domain which Selenium is served from. (For example, if your Selenium test runner is running at http://example.com/selenium/test_runner.html.... You can only manipulate cookies for example.com. Again, the key to remember is "if _javascript_ can do it... Selenium could do it"... However, I don't believe there are direct Selenium functions for dealing with cookies so you'd need to extend the API with _javascript_ to call a custom function that did this cookie manipulation. "Extending the API" sounds scary, but it won't be too hard to do. You can modify user-extension.js in the Selenium directory with your custom _javascript_ code.

For some sample code, see http://www.quirksmode.org/js/cookies.html

- Jason
_______________________________________________
Selenium-users mailing list
Selenium-users@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users

Reply via email to