Skip to content

[🚀 Feature]: Add cookies without visiting the given URL #3

@Benjamin-Loison

Description

@Benjamin-Loison

Feature and motivation

For speed and more discreet reasons.

browser.add_cookie({'name': 'COOKIE_NAME', 'value': 'COOKIE_VALUE'})
Output:
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/benjamin/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 636, in add_cookie
    self.execute(Command.ADD_COOKIE, {"cookie": cookie_dict})
  File "/home/benjamin/.local/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 347, in execute
    self.error_handler.check_response(response)
  File "/home/benjamin/.local/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidCookieDomainException: Message: Document is cookie-averse
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:191:5
InvalidCookieDomainError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:398:5
GeckoDriver.prototype.addCookie@chrome://remote/content/marionette/driver.sys.mjs:2120:11

+3

Usage example

Not read.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions