title: Adding Cookies working with Firefox webdriver but not in PhantomJS
body: <p>I have a pickle with cookies that I create through the following command</p>
  
  <pre><code>def doLogin(driver):
      #do login stuff
      pickle.dump(driver.get_cookies(), open("cookies.pkl", "wb"))
  </code></pre>
  
  <p>I have the sample code to get the cookies</p>
  
  <pre><code>driver = webdriver.PhantomJS()
  self.doLogin(driver)
  driver.delete_all_cookies()
  for cookie in pickle.load(open("cookies.pkl", "rb")):
      driver.add_cookie(cookie)
  </code></pre>
  
  <p>I can see that it creates the cookie well because if I <code>print</code> it it's fine the add_cookie() is doing shady things</p>
  
  <p>This gives the following exception</p>
  
  <blockquote>
    <p>WebDriverException: Message: {"errorMessage":"Unable to set
    Cookie","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"219","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:50738","User-Agent":"Python-urllib/2.7"},"httpVersion":"1.1","method":"POST","post":"{\"sessionId\":
    \"391db430-154a-11e6-8a0a-ef59204729f5\", \"cookie\": {\"domain\":
    \"secretWebsite\", \"name\": \"JSESSIONID\", \"value\":
    \"8332B6099FA3BBBC82893D4C7E6E918B\", \"path\": \"Also a secret\",
    \"httponly\": false, \"secure\":
    true}}","url":"/cookie","urlParsed":{"anchor":"","query":"","file":"cookie","directory":"/","path":"/cookie","relative":"/cookie","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/cookie","queryKey":{},"chunks":["cookie"]},"urlOriginal":"/session/391db430-154a-11e6-8a0a-ef59204729f5/cookie"}}
    Screenshot: available via screen</p>
  </blockquote>
  
  <p>To work, all I need is to change webdriver to Firefox</p>
  
  <p>Is this a known PhantomJS issue?</p>