TestProject Forum
Powered by leading experts in the test automation community

Session maintenance in selenium

how selenium webdriver maintains session.

for eg,wiyhout using webdriver, i have opened a browser and logged into gmail,then i closed browser without logging out. then again i opened the same browser and when i give the url,gmail.com,i am already logged into it.

with webdriver, i am not logged into gmail when i opened the second browser.

could somebody explain what is happening with webdriver.

This is the default behavior of the WebDriver.

A browser without cookies/session info/extensions is created so as to not be encumbered with preconditions that may exist from previous browsing. (Selenium enforces this since tests should be independent runs).

If you want the WebDriver to behave otherwise you need to explicitly tell it so, by adding cookies for example.