Open postmodern opened 1 year ago
@postmodern could you show an example where it's useful?
@route I want to dump out the cookies used by the current page to a file, so I can load the cookies into other tools or back into a new Ferrum::Browser
instance. I noticed that both browser.cookies
and browser.page.cookies
returns cookies for the current website domain, and all previous websites that the browser instance has visited. I suppose I could add my own method which filters browser.cookies
by comparing Cookie#domain
against URI(browser.url).host
.
Since browser.cookies
is just a convenient alias to browser.page.cookies
with default page, this behavior looks ok to me. Though I'm a bit surprised that Network.getAllCookies
returns all cookies even for previously visited websites but thinking a bit more about it and this is also appears to be correct behavior from Chrome's perspective because context stays the same. Like you said you can just filter out unneeded cookies by domain.
Maybe in ferrum 1.0.0 you could rename cookies
to cookie_jar
which would imply all cookies, and have a cookies
method that only returned the cookies used by the current page.
I feel like
browser.cookies
should return all cookies, whilebrowser.page.cookies
should only return cookies for the page, based on the current page'spath
anddomain
.