Using same session with new tab/window open

703 views
Skip to first unread message

Phú Nguyễn

unread,
Sep 5, 2016, 8:33:06 AM9/5/16
to Selenium Users
Hi guys,

I have some problem with selenium when open new window, It's create new session instead of using old.

Do you know anyway to open new window but using old session on selenium ?

I'm using selenium ver 2.44 with junit and ie driver.

praveen kumar cherukuri

unread,
Sep 5, 2016, 9:40:12 AM9/5/16
to seleniu...@googlegroups.com
Selenium is designed so. Every thread will launch a new session (Internally selenium will create a new profile of the browser, which means that the newly created profile acts like a fresh installation of browser)

This requirement can be achieved by capturing the cookies from an active session, and passing the same to the new instance. But it is an experimental approach. Few websites maintain sessions which detect few parameters and expire the session if tweaked. 


Please let us know why you are trying to maintain the same session for all your instances. 


/Praveen. 


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/77482b76-2f99-4d03-ad4f-e5cb654ac5dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Phú Nguyễn

unread,
Sep 5, 2016, 10:11:24 PM9/5/16
to Selenium Users
Hi Praveen,

I'm doing testing with test case open 2 window with same session to check if window 1 sign out, window 2 should redirect to notice if cannot found current user in session.

I just tried to copy cookies from old webdriver to new webdriver but it seem not working, still create 2 session.

Please help me on that case. Thanks


On Monday, September 5, 2016 at 8:40:12 PM UTC+7, Praveen wrote:
Selenium is designed so. Every thread will launch a new session (Internally selenium will create a new profile of the browser, which means that the newly created profile acts like a fresh installation of browser)

This requirement can be achieved by capturing the cookies from an active session, and passing the same to the new instance. But it is an experimental approach. Few websites maintain sessions which detect few parameters and expire the session if tweaked. 


Please let us know why you are trying to maintain the same session for all your instances. 


/Praveen. 

On Mon, Sep 5, 2016 at 11:47 AM, Phú Nguyễn <phun...@gmail.com> wrote:
Hi guys,

I have some problem with selenium when open new window, It's create new session instead of using old.

Do you know anyway to open new window but using old session on selenium ?

I'm using selenium ver 2.44 with junit and ie driver.

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

Phú Nguyễn

unread,
Sep 6, 2016, 12:51:05 AM9/6/16
to Selenium Users
Hi Praveen,

Actually, I just found out, if we open new window by javascript and run get(url) function, selenium will create new session for this.

Instead of calling get(url), I tried to call navigate(), It success to use same session with old one.

Thanks for your help :)

praveen kumar cherukuri

unread,
Sep 6, 2016, 3:45:45 AM9/6/16
to seleniu...@googlegroups.com
Great, thanks for sharing your trick. 

I still wonder how could these two commands differ..! 
Maybe something to investigate.. :) 

Thanks for sharing. 

/Praveen. 


To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/3d5e3b3a-d69f-497c-9152-be19ab73031c%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages