title: Restoring Firefox Session in Selenium
body: <p>I am currently automating a website and have a test which checks the functionality of the Remember Me option.
  My test script logs in, entering a valid username and password and checks the Remember Me checkbox before clicking Log In button.</p>
  
  <p>To test this functionality I save the cookies to file using pickle, close the browser and then reopen the browser (loading the cookies file). </p>
  
  <pre><code>def closeWebsite(self, saveCookies=False):
      if saveCookies:
          pickle.dump(self.driver.get_cookies(), open('cookies.pkl', 'wb'))
      self.driver.close()
  
  def openWebsite(self, loadCookies=False):
      desired_caps = {}
      desired_caps['browserName'] = 'firefox'
      profile = webdriver.FirefoxProfile(firefoxProfile)
      self.driver = webdriver.Firefox(profile)
      self.driver.get(appUrl)
      if loadCookies:
          for cookie in pickle.load(open('cookies.pkl', 'rb')):
              self.driver.add_cookie(cookie)
  </code></pre>
  
  <p>However, when I do this, the new browser is not logged in. I understand that everytime you call the open the browser a new Session is created and this session ID can be obtained using <code>driver.session_id</code>
  Is it possible, in the openWebsite method to load a driver and specify the sessionID? 
  When I test this manually, the Remember Me option works as expected. I'm just having trouble understanding how Selenium handles this case.</p>