Selenium RC - disabling cookie browser

Is it possible to disable the cookie browser using selenium, RC? If so, what is the api call or call sequence for this to happen. A function is checked in which it is necessary to check the behavior when cookies are enabled or disabled. Thanks

+1
java browser junit cookies selenium
source share
4 answers

As stated in the comment. If you use FF, you can specify the profile to be used.

How to do this, it sets browserStartCommand (the third argument to the DefaultSelenium constructor) like this:

 *custom "C:/Program Files/Mozilla Firefox/firefox.exe" -no-remote -profile "C:/Some/Path/To/Mozilla/Firefox/Profiles/selenium" 

And in this profile you can disable cookies.

+1
source share

There it is easier to use only the default profile, if on Selenium 2.x.

 FirefoxProfile profile=new FirefoxProfile(); profile.setPreference("network.cookie.cookieBehavior",2); 
+2
source share

If you intend to use Firefox, there is a special command to access the firefox template. You're using

 -firefoxProfileTemplate "path to the profile" 

as described here . I would use different profiles for cookies incl. And off So that you can control it much better.

+1
source share

Another idea (I have not tried this) is to use a special proxy between the Selenium RC client and the test web application. The proxy server will be able to filter cookies when they are requested.

There are some proxy implementations designed to develop, debug, and trace roles. I'm sure you can find one who has the cookie blocking feature.

EDIT: The advantage of this solution is browser independence.

0
source share

All Articles