Separated cookie jars by implementing webpage.cookieJar
Is it possible to have separated cookie jars for each created page?
I have a script that tests different scenarios on a webpage, logging in/out/taking actions/etc but they currently all share the same cookies making it impossible. I'm trying not to have several sublimejs instances open.
Not really what I'm trying to do. I'm trying to use separate cookie jars per page, while at the moment it is per-profile. ie:
var page1 = require('webpage').create();
var page2 = require('webpage').create();
page1.open('http://domain.com/');
page2.open('http://domain.com/');
I need page1 and page2 accessing their own cookies. Cookies set on page1 should not be accessible via page2 and visa-versa.
I have managed to hack a semi-working solution by keeping a .cookiejar property on my created page then using page.onResourceRequested and page.onResourceReceived to manage my own cookies, reading and setting the cookie headers as needed. However this does not work for cookies that are set/read using javascript on the webpage itself.
We should see if there is a solution in Gecko. Probably by allowing to load the web site in the "private browsing mode"...
I've no idea where to look, but opening multiple private windows sounds like it would be perfect.
Maybe this will be of some use? An addon that allows switching
I'm looking blindly so no idea if it's relevant here
For the moment, I don't know how to implement this feature. But PhantomJS 2.0 implements it, so we should do it.
Having a same problem, would be nice to have this feature. Currently solved by running separate Firefox processes
Firefox 56 has tab containers. We should see if we can use this feature in SlimerJS.