Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to get more information when running firefox headless? #206

Closed
573 opened this issue Jun 7, 2019 · 6 comments
Closed

Is there a way to get more information when running firefox headless? #206

573 opened this issue Jun 7, 2019 · 6 comments
Assignees

Comments

@573
Copy link

573 commented Jun 7, 2019

I was trying to run etaoin in a leiningen repl inside a nix-shell session spawned in WSL and what happens is firefox is spawned with the url optionally provided open but then immediately closes.

user=> (def driver (firefox {:headless true}))
user=> (go driver "https://en.wikipedia.org/")
ExceptionInfo throw+: {:response {:value {:error "invalid session id", :message "Tried to run command without establishing a connection", :stacktrace ""}}, :path "session/589644cd-00c2-44b0-ac39-61ee097c5ba3/url", :payload {:url "https://en.wikipedia.org/"}, :method :post, :type :etaoin/http-error, :port 19425, :host "127.0.0.1", :status 404, :driver {:args ("geckodriver" "--port" 19425), :headless true, :capabilities {:loggingPrefs {:browser "ALL"}, :moz:firefoxOptions {:args ("--headless")}}, :process #object[java.lang.UNIXProcess 0x213dfdff "java.lang.UNIXProcess@213dfdff"], :locator "xpath", :type :firefox, :env nil, :port 19425, :host "127.0.0.1", :url "http://127.0.0.1:19425", :session "589644cd-00c2-44b0-ac39-61ee097c5ba3"}} slingshot.support/stack-trace (support.clj:201)

Also tested with URL provided:

user=> (with-firefox-headless nil driver
#_=> (go driver "https://en.wikipedia.org/"))

SocketTimeoutException Read timed out java.net.SocketInputStream.socketRead0 (SocketInputStream.java:-2)

@ivarref
Copy link

ivarref commented Apr 30, 2020

Thanks for a nice project! I'd also appreciate this.

@igrishaev igrishaev assigned igrishaev and Uunnamed and unassigned igrishaev Jul 22, 2020
@igrishaev
Copy link
Collaborator

This might be caused by a broken geckodriver version (they have been breaking their stuff).

What to do:

  • try to reproduce with the latest version of etaoin/geckodriver
  • write a report here.

@573
Copy link
Author

573 commented Jul 22, 2020

EDIT: The firefox version should at least fit the geckodriver version.

$ firefox -v
Mozilla Firefox 76.0.1
$ geckodriver -V
geckodriver 0.26.0

With current nix-unstable:

nix-shell -p leiningen geckodriver firefox

therein:

lein update-in :dependencies conj '[etaoin "0.3.6"]' -- repl

gives

nREPL server started on port 49422 on host 127.0.0.1 - nrepl://127.0.0.1:49422
REPL-y 0.4.3, nREPL 0.6.0
Clojure 1.10.0
OpenJDK 64-Bit Server VM 1.8.0_242-b08
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e

user=>

also

geckodriver -v

gives

1595441861379 geckodriver DEBUG Listening on 127.0.0.1:4444

therein

user=> (use 'etaoin.api)
user=> (require '[etaoin.keys :as k])
user=> (def driver (firefox {:headless true}))

gives

Syntax error (ExceptionInfo) compiling at (REPL:1:13).
throw+: {:response {:value {:error "unknown error", :message "invalid argument: can't kill an exited process", :stacktrace ""}}, :path "session", :payload {:desiredCapabilities {:loggingPrefs {:browser "ALL"}}}, :method :post, :type :etaoin/http-error, :port 14358, :host "127.0.0.1", :status 500, :driver {:args ("geckodriver" "--port" 14358), :capabilities {:loggingPrefs {:browser "ALL"}}, :process #object[java.lang.UNIXProcess 0x79a6d487 "java.lang.UNIXProcess@79a6d487"], :locator "xpath", :type :firefox, :env nil, :port 14358, :host "127.0.0.1", :url "http://127.0.0.1:14358"}}

@igrishaev
Copy link
Collaborator

@Uunnamed could you please try to reproduce? Looks like the message "invalid argument: can't kill an exited process" means that the process was immediatelly stopped with 0 status code, and then we tried to kill it again.

@Uunnamed
Copy link
Contributor

Hi @573
There may be a problem in running the geckodriver from under the root, to check, please try to take a fresh version of etaoin(0.3.8) and run the driver in this way
(def driver (firefox {:log-stdout "ffout.log" :log-stderr "fferr.log" :args-driver ["--log" "trace"]}))
and attach the output of the log files here.
I think this is a similar problem
mozilla/geckodriver#1655

@573
Copy link
Author

573 commented Sep 16, 2020

Hi @Uunnamed
I did as before but with eatoin v0.3.10 and the def you suggested .
Direct feedback on the command line is

user=> (def driver (firefox {:log-stdout "ffout.log" :log-stderr "fferr.log" :args-driver ["--log" "trace"]}))
Syntax error (NoHttpResponseException) compiling at (REPL:1:13).
127.0.0.1:59542 failed to respond

Also got
Etaoinv0310

fferr.log

and

ffout.log

EDIT: When I start firefox before etaoin in repl I get lots of

assert@resource:///modules/AsyncTabSwitcher.jsm:499:36
preActions@resource:///modules/AsyncTabSwitcher.jsm:567:10
handleEvent@resource:///modules/AsyncTabSwitcher.jsm:1077:12
JavaScript error: resource:///modules/AsyncTabSwitcher.jsm, line 624: TypeError: null has no properties
Assertion failure

Also I can't visit any pages at all in the browser window, maybe firefox related bug ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants