etaoin

Apple 2023-05-27T14:32:10.079309Z

(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?

lread 2023-05-28T16:47:27.383929Z

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

Apple 2023-05-27T15:01:50.079329Z

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.