Fork me on GitHub
#etaoin
<
2023-05-27
>
Apple14:05:10

(ns user
  (:require [etaoin.api :as e]))

(def driver (e/firefox))
(e/go driver "")
(def saved-cookies (e/get-cookies driver))

(def driver1 (e/firefox))

;; got error here
(for [cookie saved-cookies]
  (e/set-cookie driver1 cookie))
(e/go driver1 "")
Hi. Trying to preload saved cookies and got this error ":error "invalid cookie domain", :message "Cookies may only be set for the current domain" what's the right way to do this?

Apple15:05:50

Ok so the problem is that user got redirected to http://auth.xyz.com first if not authenticated already. the solution is to save the cookies before http://auth.xyz.com redirects back to http://xyz.com then visit http://xyz.com, load the saved cookies and visit http://xyz.com again.

lread16:05:27

Was just about to have a peek at this @UP82LQR9N and saw that you figured it out. Thanks for sharing your findings, they will surely help someone else in the same boat.