Skip to content

Conversation

@n-studio
Copy link

From https://www.selenium.dev/documentation/support_packages/working_with_cookies/

Add Cookie

It is used to add a cookie to the current browsing context. Add Cookie only accepts a set of defined serializable JSON object. Here is the link to the list of accepted JSON key values

First of all, you need to be on the domain that the cookie will be valid for. If you are trying to preset cookies before you start interacting with a site and your homepage is large / takes a while to load an alternative is to find a smaller page on the site (typically the 404 page is small, e.g. http://example.com/some404page)

Selenium recommends to load a small page to load the cookies before interacting with a site.

This PR allows to set a custom url to set cookies.

@start_urls = [{ url: "http://example.com", data: { preset_cookies_url: "http://example.com/some404page" } }]

(Kind of) fixes #63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting cookies will request a page twice

1 participant