{"action":"opened","issue":{"url":"https://api.github.com/repos/cobrateam/splinter/issues/388","labels_url":"https://api.github.com/repos/cobrateam/splinter/issues/388/labels{/name}","comments_url":"https://api.github.com/repos/cobrateam/splinter/issues/388/comments","events_url":"https://api.github.com/repos/cobrateam/splinter/issues/388/events","html_url":"https://github.com/cobrateam/splinter/issues/388","id":68568683,"number":388,"title":"CookieManager.add does not support path etc (only name/value)","user":{"login":"blueyed","id":9766,"avatar_url":"https://avatars.githubusercontent.com/u/9766?v=3","gravatar_id":"","url":"https://api.github.com/users/blueyed","html_url":"https://github.com/blueyed","followers_url":"https://api.github.com/users/blueyed/followers","following_url":"https://api.github.com/users/blueyed/following{/other_user}","gists_url":"https://api.github.com/users/blueyed/gists{/gist_id}","starred_url":"https://api.github.com/users/blueyed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blueyed/subscriptions","organizations_url":"https://api.github.com/users/blueyed/orgs","repos_url":"https://api.github.com/users/blueyed/repos","events_url":"https://api.github.com/users/blueyed/events{/privacy}","received_events_url":"https://api.github.com/users/blueyed/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-04-15T04:13:25Z","updated_at":"2015-04-15T04:13:25Z","closed_at":null,"body":"`selenium/webdriver/remote/webdriver.py` allows for additional keys, like `path`, `domain`, `secure` and `expiry`:\r\n\r\n    def add_cookie(self, cookie_dict):\r\n        \"\"\"\r\n        Adds a cookie to your current session.\r\n\r\n        :Args:\r\n         - cookie_dict: A dictionary object, with required keys - \"name\" and \"value\";\r\n            optional keys - \"path\", \"domain\", \"secure\", \"expiry\"\r\n\r\n        Usage:\r\n            driver.add_cookie({'name' : 'foo', 'value' : 'bar'})\r\n            driver.add_cookie({'name' : 'foo', 'value' : 'bar', 'path' : '/'})\r\n            driver.add_cookie({'name' : 'foo', 'value' : 'bar', 'path' : '/', 'secure':True})\r\n\r\n        \"\"\"\r\n        self.execute(Command.ADD_COOKIE, {'cookie': cookie_dict})\r\n\r\n\r\nBut this is not supported through splinter's CookieManager:\r\n\r\n    class CookieManager(CookieManagerAPI):\r\n\r\n        def __init__(self, driver):\r\n            self.driver = driver\r\n\r\n        def add(self, cookies):\r\n            if isinstance(cookies, list):\r\n                for cookie in cookies:\r\n                    for key, value in cookie.items():\r\n                        self.driver.add_cookie({'name': key, 'value': value})\r\n                    return\r\n            for key, value in cookies.items():\r\n                self.driver.add_cookie({'name': key, 'value': value})\r\n\r\n\r\nThe workaround appears to be calling `driver.add_cookie` directly.\r\n\r\n(There appears to be another issue with this workaround though, because the cookie does not seem to \"stick\", when `visit()` has not been called before - using the cookie from Django's `client` for admin login; I'll have to debug this)\r\n"}}