This feature is quite important.
A running PhantomJS process, currently, shares the same CookieJar across multiple WebPage.
While this is the correct behaviour in a normal browser (i.e. if you open 2 tabs on www.examplemail.com and log in in one of them, you will log in in the other as well).
We need PhantomJS to support the option to create a WebPage with a new, fresh, independent CookieJar.
This work will require intervention on both GhostDriver & PhantomJS codebase.
Original Title was: Unique sessions not being treated as such?
Pardon if I am mistaken, as I'm new to ghostdriver / selenium.
I came across this problem when I noticed that my (python) client was using old sessions, even after quitting the client instance and restarting it. I tried using driver.start_session(), which changed the driver.session_id but as far as I could tell it was being treated as the same session (ie: I was still authenticated as a user). Also tried deleting cookies, but it was reporting that none were to be found.
The client is correctly using new sessionId in its POST request over the Wire.
If I restart the phantomjs --webdriver instance, the session clears out properly.
Currently there is a limitation in PhantomJS that doesn't allow to separate cookiejar across sessions in the same Phantomjs process instance.
I don't remember if it's there already, but if not could you please file an issue to develop this feature?
In the meantime though don't despair: you could use Python bindings and create a new Driver instance every time. That takes care of staring a new phantomjs instance every time for you.
I have actually converted this story.
What would be your suggested route? Are there python bindings for phantomjs
to start/stop the process, Or do I just make a call to the shell?
Thanks for the response and for filing the ticket.
Sent from my mobile.
On Jan 25, 2013, at 5:09 AM, Ivan De Marino firstname.lastname@example.org
Currently there is a limitation in PhantomJS that doesn't allow to separate
cookiejar across sessions in the same Phantomjs process instance.
I don't remember if it's there already, but if not could you please file an
issue to develop this feature?
In the meantime though don't despair: you could use Python bindings and
create a new Driver instance every time. That takes care of staring a new
phantomjs instance every time for you.
Reply to this email directly or view it on
The current Python PhantomJSDriver bindings should create a new process for every new PhantomJSDriver object.
@detro Note that we had some discussion on this topic a while ago in #90, in case that is helpful.
Another area to consider for session isolation is the fs module - changeWorkingDirectory changes the working directory for all sessions. Of course, this will require support in webdriver itself unless ghostdriver starts a new process for each session.
The use case for this is using phantomjs/ghostdriver as a server for sending build commands.
I'm currently working on adding support to the new "multi-cookiejar" feature of PhantomJS (that has just landed).
@detro when will this be available in PhantomJS ?
👍 I'm also very interested to know this, as currently it breaks our selenium tests, that treat every test as a clean browser
ghostdriver 1.1.1 is already in phantomjs's master branch (1.10.0-dev). I built a .deb package for ubuntu 12.04. As a quick test, I ran behat and found many features failing that previously passed with selenium+firefox. If anyone else is interested in trying it out:
@robocoder is there more failures than when running it against PhantomJS 1.9.7 (see the Travis builds) ? If yes, it could indicate some regression in either PhantomJS 1.10 or GhostDriver 1.1.1
FYI: Ghostdriver 1.1.1, and hence also the fix for this issue, is not in any released PhantomJS versions as of today. PhantomJS 1.9.6 included Ghostdriver 1.1.1 but this was never working. So PhantomJS 1.9.7 reverted to Ghostdriver 1.1.0.
Whats the current status of this issue? Session/context isolation is imperative for running our Behat tests so this is pretty important :)
The code on the GhostDriver side is part of 1.1.1.
That hasn't been released inside PhantomJS yet.
You gotta build PhantomJS master for this.
That said, all the (little!) energy this community can summon in terms on contributions is focused on pushing PhantomJS 2 out.
So, for 1.x you have to compile it yourself.
For 2.x... soon...
I need a new feature 'Session/context isolation' and
I try to build PhantomJS from master.
But I got error:
"icu.cpp:42:28: fatal error: unicode/utypes.h: No such file or directory"
I need an assistance.
Try installing libicu-dev
You may need all these dependencies as listed here:
sudo apt-get install libsqlite3-dev ruby gperf bison flex libfontconfig1-dev libicu-dev fontconfig libssl-dev
So what's the recommended way to get this functionality right now? Doesn't seem to be there with 2.0.0