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

api js-execute not working when using docker firefox standalone #523

Closed
emhusnan opened this issue Mar 8, 2023 · 3 comments
Closed

api js-execute not working when using docker firefox standalone #523

emhusnan opened this issue Mar 8, 2023 · 3 comments

Comments

@emhusnan
Copy link

emhusnan commented Mar 8, 2023

Thanks for awesome etaoin.
I'm playing around with e/js-execute, it's working well when using local driver :path-driver.
However when I tried using docker firefox standalone and move to :webdriver-url give me exception

throw+: {:response {:value {:error "unknown command",.....

Remote webdriver was tested using python and it's working, able to run js.
Need help how to solve this issue?


Snippet code

(ns newfoundland-scraper.playground
  (:require
    [etaoin.api :as e]
    [etaoin.keys :as k]))

(defn try-js-inside-docker []
  (e/with-firefox {:webdriver-url "http://127.0.0.1:4444"
                   :capabilities  {"firefoxOptions" {"args" ["--no-sandbox"]}}}
                  driver                                    ;from this line browser will show up
                  (e/js-execute driver "alert(\"Hello World\")") ;exception when run this line inside docker
                  (e/wait driver 30)))

Docker command

docker run --rm -p 4444:4444 -p 5900:5900 --shm-size="2g" selenium/standalone-firefox:109.0-geckodriver-0.32-20230210

REPL exception

Execution error (ExceptionInfo) at slingshot.support/stack-trace (support.clj:201).
throw+: {:response {:value {:error "unknown command", :message "POST /session/14968a74-46c2-419f-a4aa-b7b433c3ddc0/execute/sync\nBuild info: version: '4.8.0', revision: '267030adea'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.1.11-arch1-1', java.version: '11.0.17'\nDriver info: driver.version: unknown", :stacktrace "org.openqa.selenium.UnsupportedCommandException: POST /session/14968a74-46c2-419f-a4aa-b7b433c3ddc0/execute/sync\nBuild info: version: '4.8.0', revision: '267030adea'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.1.11-arch1-1', java.version: '11.0.17'\nDriver info: driver.version: unknown\n\tat org.openqa.selenium.remote.codec.AbstractHttpCommandCodec.decode(AbstractHttpCommandCodec.java:293)\n\tat org.openqa.selenium.remote.codec.AbstractHttpCommandCodec.decode(AbstractHttpCommandCodec.java:122)\n\tat org.openqa.selenium.grid.web.ProtocolConverter.execute(ProtocolConverter.java:123)\n\tat org.openqa.selenium.grid.node.ProtocolConvertingSession.execute(ProtocolConvertingSession.java:75)\n\tat org.openqa.selenium.grid.node.local.SessionSlot.execute(SessionSlot.java:127)\n\tat org.openqa.selenium.grid.node.local.LocalNode.executeWebDriverCommand(LocalNode.java:470)\n\tat org.openqa.selenium.grid.node.ForwardWebDriverCommand.execute(ForwardWebDriverCommand.java:35)\n\tat org.openqa.selenium.remote.http.Route$PredicatedRoute.handle(Route.java:373)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:86)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.grid.node.Node.execute(Node.java:245)\n\tat org.openqa.selenium.grid.web.CombinedHandler.execute(CombinedHandler.java:59)\n\tat org.openqa.selenium.grid.web.RoutableHttpClientFactory$1.execute(RoutableHttpClientFactory.java:72)\n\tat org.openqa.selenium.grid.web.ReverseProxyHandler.execute(ReverseProxyHandler.java:92)\n\tat org.openqa.selenium.grid.router.HandleSession.execute(HandleSession.java:122)\n\tat org.openqa.selenium.remote.http.Route$PredicatedRoute.handle(Route.java:373)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.grid.router.Router.execute(Router.java:91)\n\tat org.openqa.selenium.grid.web.EnsureSpecCompliantResponseHeaders.lambda$apply$0(EnsureSpecCompliantResponseHeaders.java:34)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)\n\tat org.openqa.selenium.remote.http.Route.execute(Route.java:68)\n\tat org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)\n\tat org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)\n\tat org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)\n\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base/java.lang.Thread.run(Thread.java:829)\n"}}, :path "session/14968a74-46c2-419f-a4aa-b7b433c3ddc0/execute/sync", :payload {:script "alert(\"Hello World\")", :args []}, :method :post, :type :etaoin/http-error, :port 37671, :host "127.0.0.1", :status 404, :webdriver-url "http://127.0.0.1:4444", :driver {:type :firefox, :host "127.0.0.1", :port 37671, :url "http://127.0.0.1:37671", :locator "xpath", :webdriver-url "http://127.0.0.1:4444", :capabilities {"firefoxOptions" {"args" ["--no-sandbox"]}}, :session "14968a74-46c2-419f-a4aa-b7b433c3ddc0"}}

logs from docker

09:32:19.032 WARN [SeleniumSpanExporter$1.lambda$export$1] - org.openqa.selenium.UnsupportedCommandException: POST /session/14968a74-46c2-419f-a4aa-b7b433c3ddc0/execute/sync
Build info: version: '4.8.0', revision: '267030adea'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '6.1.11-arch1-1', java.version: '11.0.17'
Driver info: driver.version: unknown
        at org.openqa.selenium.remote.codec.AbstractHttpCommandCodec.decode(AbstractHttpCommandCodec.java:293)
        at org.openqa.selenium.remote.codec.AbstractHttpCommandCodec.decode(AbstractHttpCommandCodec.java:122)
        at org.openqa.selenium.grid.web.ProtocolConverter.execute(ProtocolConverter.java:123)
        at org.openqa.selenium.grid.node.ProtocolConvertingSession.execute(ProtocolConvertingSession.java:75)
        at org.openqa.selenium.grid.node.local.SessionSlot.execute(SessionSlot.java:127)
        at org.openqa.selenium.grid.node.local.LocalNode.executeWebDriverCommand(LocalNode.java:470)
        at org.openqa.selenium.grid.node.ForwardWebDriverCommand.execute(ForwardWebDriverCommand.java:35)
        at org.openqa.selenium.remote.http.Route$PredicatedRoute.handle(Route.java:373)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
        at org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute(SpanWrappedHttpHandler.java:86)
        at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
        at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
        at org.openqa.selenium.grid.node.Node.execute(Node.java:245)
        at org.openqa.selenium.grid.web.CombinedHandler.execute(CombinedHandler.java:59)
        at org.openqa.selenium.grid.web.RoutableHttpClientFactory$1.execute(RoutableHttpClientFactory.java:72)
        at org.openqa.selenium.grid.web.ReverseProxyHandler.execute(ReverseProxyHandler.java:92)
        at org.openqa.selenium.grid.router.HandleSession.execute(HandleSession.java:122)
        at org.openqa.selenium.remote.http.Route$PredicatedRoute.handle(Route.java:373)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
        at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
        at org.openqa.selenium.grid.router.Router.execute(Router.java:91)
        at org.openqa.selenium.grid.web.EnsureSpecCompliantResponseHeaders.lambda$apply$0(EnsureSpecCompliantResponseHeaders.java:34)
        at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
        at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
        at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
        at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
        at org.openqa.selenium.remote.http.Route$CombinedRoute.handle(Route.java:336)
        at org.openqa.selenium.remote.http.Route.execute(Route.java:68)
        at org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0(AddWebDriverSpecHeaders.java:35)
        at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
        at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
        at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0(ErrorFilter.java:44)
        at org.openqa.selenium.remote.http.Filter$1.execute(Filter.java:64)
        at org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0(SeleniumHandler.java:44)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
@emhusnan emhusnan changed the title e/js-execute not working when using docker firefox standalone api js-execute not working when using docker firefox standalone Mar 8, 2023
@lread
Copy link
Collaborator

lread commented Mar 8, 2023

Hi @emhusnan, I'll take a look sometime soon, but it looks like you are using a Selenium Grid docker image.
So my initial guess is that this might be a dupe of #378.

@emhusnan
Copy link
Author

emhusnan commented Mar 9, 2023

@lread thanks for your time.
Yes I'm using selenium grid docker image. I bet in technically same with #378 , selenium grid have extra layer for driver.
Well I test using standalone chrome image, and it's working.

docker run --rm -p 4444:4444 -p 5900:5900 --shm-size="2g" selenium/standalone-chrome:110.0

Issue only happen when using firefox.

Anyway forgot to mention
etaoin is latest version 1.0.39

@lread lread added the duplicate label Mar 9, 2023
@lread
Copy link
Collaborator

lread commented Mar 9, 2023

Thanks for following up @emhusnan, I'll close this as a dupe of #378.

Please do reply if you feel we need to keep this issue open.

@lread lread closed this as not planned Won't fix, can't repro, duplicate, stale Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants