0

I initially open a browser window using:

$driver = Selenium::WebDriver.for :firefox, :profile => profile

and then run code to log in to the site.

I then close the window using

$driver.quit

I would like to reopen the browser to run tests against the site without having to log in again. I would like to know if there's a way to open the browser retaining my cookie that I am logged in.

Right now if I do another $driver = Selenium::WebDriver.for :firefox, :profile => profile, it shows me as not logged in.

True_Blue
  • 1,387
  • 2
  • 10
  • 13
  • Related: http://stackoverflow.com/questions/15058462/how-to-save-and-load-cookies-using-python-selenium-webdriver. – alecxe Apr 03 '15 at 18:53

1 Answers1

1

Quiting browser is killing it's session instantly with all info (cookies, sessions etc) it has. One way is to save all the cookies before quiting and to apply them in another test once again.

Another solution is to have a pre-defined profile, with which you are opening browser for every test. Then all your data will be stored (depending on browser settings), but swuch tests couldn't be called really "clear" ones.

Stan E
  • 3,396
  • 20
  • 31