title: Add cookie with domain
body: <p>I am trying to load a web page that requires authentication with selenium/ phantom driver. I have the required cookie from my session which I pass over to the the <code>driver.add_cookie</code> but I always get the error saying </p>
  
  <blockquote>
    <p>Can only set Cookies for the current domain. </p>
  </blockquote>
  
  <p>Edit: After calling <code>add_cookie</code> with the domain name, I still get the error </p>
  
  <blockquote>
    <p>Unable to set cookie</p>
  </blockquote>
  
  <pre><code>driver = webdriver.PhantomJS(desired_capabilities=dcap, service_args=service_args)
  driver.get(url)
  driver.add_cookie({'name': 'session', 'value': session, 'domain': 'localhost:25000', 'path': '/'})
  </code></pre>
  
  <p>I tried setting the proxy as follows:</p>
  
  <pre><code>service_args = ['--proxy=127.0.0.1:25000', '--proxy-type=http']
  </code></pre>
  
  <p>but it still makes the request from a different port</p>
  
  <p>I also want to set the user agent but this is  not working too:</p>
  
  <pre><code>dcap = DesiredCapabilities.PHANTOMJS.copy()
  dcap["phantomjs.page.settings.userAgent"] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/53 (KHTML, like Gecko) Chrome/15.0.87"
  </code></pre>
  
  <p>Anyhow, everything works fine when I use curl with the terminal</p>
  
  <p>The error message headers also suggests that the request is a POST request and from the logs I can also see that it gets redirected to the login page</p>
  
  <p>How can I set the cookies for the current domain?</p>