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

Have issues with wait-visible & fill functions when running via remote webdriver #520

Closed
DonCziken opened this issue Feb 2, 2023 · 4 comments

Comments

@DonCziken
Copy link

Version
[etaoin "1.0.39"]

Platform
Operating System: Ubuntu 18.04.6 LTS
Clojure version: org.clojure/clojure "1.9.0"
JDK vendor and version: OpenJDK Runtime Environment (build 1.8.0_352-8u352-ga-1~18.04-b08)

Browser vendor: chrome
WebDriver version: https://github.com/SeleniumHQ/docker-selenium / selenium/standalone-chrome:4.8.0-20230131
Local version: Version 109.0.5414.74 (Official Build) Built on Ubuntu , running on Ubuntu 18.04 (64-bit)

Symptom
using either wait-visible or fill functions while connected to remote webdriver returns following stack trace:

Exception in thread "main" java.lang.AssertionError: Assert failed: (some? el)
	at etaoin.api$fn__13521.invokeStatic(api.clj:2820)
	at etaoin.api$fn__13521.doInvoke(api.clj:2820)
	at clojure.lang.RestFn.invoke(RestFn.java:445)
	at clojure.lang.MultiFn.invoke(MultiFn.java:238)
	at clojure.lang.AFn.applyToHelper(AFn.java:160)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invokeStatic(core.clj:663)
	at clojure.core$apply.invoke(core.clj:652)
	at etaoin.api$fill.invokeStatic(api.clj:2872)
	at etaoin.api$fill.doInvoke(api.clj:2861)
	at clojure.lang.RestFn.invoke(RestFn.java:445)
	at ct.s.core$login_BANG_.invokeStatic(core.clj:37)
	at ct.s.core$login_BANG_.invoke(core.clj:31)
	at ct.core$sync_BANG_.invokeStatic(core.clj:210)
	at ct.core$sync_BANG_.invoke(core.clj:205)
	at ct.cli$run_program_BANG_.invokeStatic(cli.clj:41)
	at ct.cli$run_program_BANG_.invoke(cli.clj:29)
	at ct.cli$_main.invokeStatic(cli.clj:176)
	at ct.cli$_main.doInvoke(cli.clj:167)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at clojure.lang.AFn.applyToHelper(AFn.java:156)
	at clojure.lang.RestFn.applyTo(RestFn.java:132)
	at ct.cli.main(Unknown Source)

Reproduction

run (to spawn a remote webdriver):
docker run -d -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-chrome:4.8.0-20230131

then using REPL - show that when connected to remote this function doesn't work, while they do when running with direct webdriver:

Clojure 1.9.0
user=> (require '[etaoin.api :as e])
nil
user=> (def driver (e/chrome {:webdriver-url "http://localhost:4444" :capabilities {"chromeOptions" {"args" ["--no-sandbox"]}}}))
#'user/driver
user=> (e/go driver "https://google.com")
{:state "success", :sessionId nil, :class "org.openqa.selenium.remote.Response", :value nil, :status 0}
user=> (e/wait-visible driver [{:tag :input :name "q"}])
AssertionError Assert failed: (some? el)  etaoin.api/eval6116/fn--6117 (api.clj:2302)
user=> (e/fill driver [{:tag :input :name "q"}] "test")
AssertionError Assert failed: (some? el)  etaoin.api/eval6360/fn--6361 (api.clj:2820)
user=> (e/quit driver)
{:type :chrome, :host "127.0.0.1", :port 38557, :url "http://127.0.0.1:38557", :locator "xpath", :webdriver-url "http://localhost:4444", :capabilities {"chromeOptions" {"args" ["--no-sandbox"]}}}
user=> (def driver (e/chrome))
#'user/driver
user=> (e/go driver "https://google.com")
{:sessionId "9a565b54d3c5cdbd1ba41e8a6a111699", :status 0, :value nil}
user=> (e/wait-visible driver [{:tag :input :name "q"}])
nil
user=> (e/fill driver [{:tag :input :name "q"}] "test")
{:sessionId "9a565b54d3c5cdbd1ba41e8a6a111699", :status 0, :value nil}
user=> (e/quit driver)
{:type :chrome, :host "127.0.0.1", :port 46785, :url "http://127.0.0.1:46785", :locator "xpath", :capabilities {:loggingPrefs {:browser "ALL"}}, :args ("chromedriver" "--port=46785"), :process {:proc #object[java.lang.UNIXProcess 0x184bb873 "java.lang.UNIXProcess@184bb873"], :exit nil, :in #object[java.lang.UNIXProcess$ProcessPipeOutputStream 0x5eba9e41 "java.lang.UNIXProcess$ProcessPipeOutputStream@5eba9e41"], :out #object[java.lang.ProcessBuilder$NullInputStream 0x564d3940 "java.lang.ProcessBuilder$NullInputStream@564d3940"], :err #object[java.lang.ProcessBuilder$NullInputStream 0x564d3940 "java.lang.ProcessBuilder$NullInputStream@564d3940"], :prev nil, :cmd ["chromedriver" "--port=46785"]}}

Following were used desp for above REPL:

{:deps {org.clojure/clojure {:mvn/version "1.9.0"}
        etaoin/etaoin {:mvn/version "1.0.39"}}}

Expected behavior
To work the same as in case of direct webdriver

Diagnosis
No clue :).

Action
Waiting for contributors investigation and hopefully a fix.

Other
This issue was found during investigating following: #519

@lread
Copy link
Collaborator

lread commented Feb 3, 2023

@DonCziken that does seem weird, I'll take a look.

@lread
Copy link
Collaborator

lread commented Feb 3, 2023

Ah. Right. You are using a Selenium Grid docker image. This is probably a dupe of #378.

We should probably just address #378.

@DonCziken
Copy link
Author

oh, ok - agreed, #378 is probably the case here - somehow I did not notice it!

@lread
Copy link
Collaborator

lread commented Feb 4, 2023

oh, ok - agreed, #378 is probably the case here - somehow I did not notice it!

Well, don't feel bad, it took me a long while to notice that your docker image was using Selenium Grid! And then to remember that is currently an issue.

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

2 participants