Fork me on GitHub
#etaoin
<
2021-02-08
>
MatthewLisp20:02:40

Hello 👋

MatthewLisp20:02:30

I'm using etaoin, and before anything else, i want to say, it's an amazing library, and very comfortable to use it, specially in a REPL driven environment like Clojure can provide 😄 so, i'm using etaoin with firefox was trying to open new windows, and i stumbled on the function create-session , i quote the docs:

create-session
(create-session driver & [capabilities])

Initiates a new session for a driver. Opens a browser window as a
side-effect. All the further requests are made within specific
session. Some drivers may work with only one active session. Returns
a long string identifier.
And i'm trying on my repl:
(def driver (etaoin/firefox {:host "localhost"}))
(etaoin/create-session driver)

>> Execution error (ExceptionInfo) at slingshot.support/stack-trace (support.clj:201).
throw+: {:response {:value {:error "session not created", :message "Session is already started", :stacktrace ""}}, :path "session", :payload {:desiredCapabilities {}}, :method :post, :type :etaoin/http-error, :port 4444, :host "localhost", :status 500, :driver {:type :firefox, :host "localhost", :port 4444, :url "", :locator "xpath", :capabilities nil}}
As the doc says Some drivers may work with only one active session. is this the case of firefox? and also, i saw this on mozilla docs: https://developer.mozilla.org/en-US/docs/Web/WebDriver/Commands/New_Window Which seems to be a way to open a window, but i didn't found this function on etaoin, any thoughts ?

MatthewLisp13:02:51

It seems firefox geckodriver (it's webdriver implementation), actually do requires one geckodriver instance per session: https://github.com/mozilla/geckodriver/issues/1213 And about opening a new window, i don't know if it's a function that is really missing from etaoin's API, but here is the code for opening a new window:

(def driver (etaoin/firefox {:host "localhost"}))

(etaoin/execute {:driver driver
                   :method :post
                   :path [:session (:session driver) :window :new]
                   :data {:type "window"}})