Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Python add_cookie documentation not clear, NullPointerExceptions raised without name= and value= passed in. #2367

Closed
lukeis opened this issue Mar 3, 2016 · 5 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 3, 2016

Originally reported on Google Code with ID 2367

What steps will reproduce the problem?

driver.get("http://www.google.com");
# Now set the cookie. This one's valid for the entire domain
cookie = {"key": "value"})
driver.add_cookie(cookie)

NullPointerException will be raised.  The documentation is not explicit that name=
and value= parameters must be specified.

What is the expected output? What do you see instead?

Selenium version: 2.5.0

Patch to revise Python documentation included.

Reported by roger.hu on 2011-08-30 17:05:06


- _Attachment: [add_cookie.txt](https://storage.googleapis.com/google-code-attachments/selenium/issue-2367/comment-0/add_cookie.txt)_
@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

As of 2.5.0, it also seems that a secure= option is also needed:

Both appear to be acceptable:
1. driver.add_cookie({'name' : 'foo': 'value' : 'bar', 'secure' : False})
2. driver.add_cookie({'name' : 'foo': 'value' : 'bar', 'path' : '/', 'secure' : False})


Reported by roger.hu on 2011-08-30 18:59:16

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by barancev on 2011-10-13 08:37:16

  • Labels added: Lang-Python, Component-Docs, Component-WebDriver

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

This issue was closed by revision r14834.

Reported by luke.semerau on 2011-11-21 06:23:00

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

For those like me who come across this and want to use it as a demo, the ':' after 'foo'
should be a ',' in Comment #1 above.

Reported by harold.martin on 2012-07-19 23:56:50

@lukeis
Copy link
Member Author

lukeis commented Mar 3, 2016

Reported by luke.semerau on 2015-09-17 18:13:37

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 3, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant