How to set cookies in phantomjs using selenium with python?
<p><a href="https://i.stack.imgur.com/gMWqc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gMWqc.png" alt="enter image description here"></a></p>

<p>It raise an error message said "Can only set Cookies for the current domain",but all I did is just put the old cookies in.Sometime I add the 'correct' domain,it will raise error Message "Unable to set Cookie".
And I tested it in Firefox,Firefox also cant work.</p>

<pre><code>from selenium import webdriver
driver = webdriver.PhantomJS(executable_path=phantompath)
driver.get('http://stackoverflow.com/')
driver.get_screenshot_as_file('1.png')
cookies = driver.get_cookies()
driver.delete_all_cookies()
driver.get_cookies()
for cookie in cookies:
    driver.add_cookie(cookie)
</code></pre>