Open bhougland18 opened 4 years ago
Here are some helper functions we use to pull cookies out from the driver (and transform them to a Clojure map).
(defn ^:private cookie->map [^org.openqa.selenium.Cookie cookie]
{:secure? (.isSecure cookie)
:http-only? (.isHttpOnly cookie)
:domain (.getDomain cookie)
:expiry (.getExpiry cookie)
:name (.getName cookie)
:path (.getPath cookie)
:value (.getValue cookie)})
(defn get-cookie
([key] (get-cookie limo.api/*driver* key))
([driver key] (cookie->map (.. driver manage (getCookieNamed key)))))
(defn all-cookies
([] (all-cookies limo.api/*driver*))
([driver] (map cookie->map (seq (.. driver manage getCookies)))))
If these are useful, perhaps we should add them to limo @jeffh / @bhougland18 ?
@sheelc
Thank you for this information! I think this would be useful because it looks like you can only delete cookies at the moment.
Yeah, I’d think it would be useful to add. We should probably port that helper code we have internally into limo.
What would be the best way to get the cookies from selenium driver?