New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Session Isolation #170

Closed
akoumjian opened this Issue Jan 25, 2013 · 18 comments

Comments

Projects
None yet
@akoumjian

akoumjian commented Jan 25, 2013

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.

@detro

This comment has been minimized.

Show comment
Hide comment
@detro

detro Jan 25, 2013

Owner

Hi,
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.

Owner

detro commented Jan 25, 2013

Hi,
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.

@detro

This comment has been minimized.

Show comment
Hide comment
@detro

detro Jan 25, 2013

Owner

I have actually converted this story.

Thanks

Owner

detro commented Jan 25, 2013

I have actually converted this story.

Thanks

@akoumjian

This comment has been minimized.

Show comment
Hide comment
@akoumjian

akoumjian Jan 25, 2013

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 notifications@github.com
wrote:

Hi,
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
GitHubhttps://github.com/detro/ghostdriver/issues/170#issuecomment-12700059.

akoumjian commented Jan 25, 2013

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 notifications@github.com
wrote:

Hi,
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
GitHubhttps://github.com/detro/ghostdriver/issues/170#issuecomment-12700059.

@detro

This comment has been minimized.

Show comment
Hide comment
@detro

detro Jan 25, 2013

Owner

The current Python PhantomJSDriver bindings should create a new process for every new PhantomJSDriver object.

Owner

detro commented Jan 25, 2013

The current Python PhantomJSDriver bindings should create a new process for every new PhantomJSDriver object.

@garyd203

This comment has been minimized.

Show comment
Hide comment
@garyd203

garyd203 Jan 29, 2013

Contributor

@detro Note that we had some discussion on this topic a while ago in #90, in case that is helpful.

Contributor

garyd203 commented Jan 29, 2013

@detro Note that we had some discussion on this topic a while ago in #90, in case that is helpful.

@jroper

This comment has been minimized.

Show comment
Hide comment
@jroper

jroper Oct 29, 2013

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.

jroper commented Oct 29, 2013

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.

@detro

This comment has been minimized.

Show comment
Hide comment
@detro

detro Jan 12, 2014

Owner

I'm currently working on adding support to the new "multi-cookiejar" feature of PhantomJS (that has just landed).

Owner

detro commented Jan 12, 2014

I'm currently working on adding support to the new "multi-cookiejar" feature of PhantomJS (that has just landed).

@detro detro closed this in e401410 Jan 12, 2014

@stof

This comment has been minimized.

Show comment
Hide comment
@stof

stof Feb 5, 2014

@detro when will this be available in PhantomJS ?

stof commented Feb 5, 2014

@detro when will this be available in PhantomJS ?

@altryne

This comment has been minimized.

Show comment
Hide comment
@altryne

altryne Mar 13, 2014

👍 I'm also very interested to know this, as currently it breaks our selenium tests, that treat every test as a clean browser

altryne commented Mar 13, 2014

👍 I'm also very interested to know this, as currently it breaks our selenium tests, that treat every test as a clean browser

@neoascetic

This comment has been minimized.

Show comment
Hide comment
@neoascetic

neoascetic commented Mar 20, 2014

+1

@robocoder

This comment has been minimized.

Show comment
Hide comment
@robocoder

robocoder Mar 26, 2014

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:

https://dl.dropboxusercontent.com/u/109363425/phantomjs_1.10.0instaclick1_amd64.deb

robocoder commented Mar 26, 2014

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:

https://dl.dropboxusercontent.com/u/109363425/phantomjs_1.10.0instaclick1_amd64.deb

@stof

This comment has been minimized.

Show comment
Hide comment
@stof

stof Mar 26, 2014

@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

stof commented Mar 26, 2014

@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

@oberlies

This comment has been minimized.

Show comment
Hide comment
@oberlies

oberlies May 15, 2014

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.

oberlies commented May 15, 2014

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.

@tomasgriffin

This comment has been minimized.

Show comment
Hide comment
@tomasgriffin

tomasgriffin Jun 17, 2014

Whats the current status of this issue? Session/context isolation is imperative for running our Behat tests so this is pretty important :)

tomasgriffin commented Jun 17, 2014

Whats the current status of this issue? Session/context isolation is imperative for running our Behat tests so this is pretty important :)

@detro

This comment has been minimized.

Show comment
Hide comment
@detro

detro Jun 19, 2014

Owner

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...

Owner

detro commented Jun 19, 2014

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...

@horus-by

This comment has been minimized.

Show comment
Hide comment
@horus-by

horus-by Sep 18, 2014

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.

horus-by commented Sep 18, 2014

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.

@CL0SeY

This comment has been minimized.

Show comment
Hide comment
@CL0SeY

CL0SeY Oct 27, 2014

Try installing libicu-dev
You may need all these dependencies as listed here:
https://github.com/ariya/phantomjs/wiki/PhantomJS-2

sudo apt-get install libsqlite3-dev ruby gperf bison flex libfontconfig1-dev libicu-dev fontconfig libssl-dev

CL0SeY commented Oct 27, 2014

Try installing libicu-dev
You may need all these dependencies as listed here:
https://github.com/ariya/phantomjs/wiki/PhantomJS-2

sudo apt-get install libsqlite3-dev ruby gperf bison flex libfontconfig1-dev libicu-dev fontconfig libssl-dev
@georgiosd

This comment has been minimized.

Show comment
Hide comment
@georgiosd

georgiosd Dec 11, 2015

So what's the recommended way to get this functionality right now? Doesn't seem to be there with 2.0.0

georgiosd commented Dec 11, 2015

So what's the recommended way to get this functionality right now? Doesn't seem to be there with 2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment