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

sel crashes when the element doesn't exist yet #27

Closed
jleonard-r7 opened this issue Nov 6, 2020 · 5 comments
Closed

sel crashes when the element doesn't exist yet #27

jleonard-r7 opened this issue Nov 6, 2020 · 5 comments

Comments

@jleonard-r7
Copy link
Contributor

you probably want visible here:
https://github.com/oliyh/kamera/blob/master/src/clj/kamera/core.clj#L203

rather than sel.

@jleonard-r7
Copy link
Contributor Author

This is the stack trace:

ERROR in (devcards-test) (command.clj:25)
Uncaught exception, not in assertion.
expected: nil
  actual: clojure.lang.ExceptionInfo: Error in command DOM.querySelectorAll: Could not find node with given id
{:request {:id 9, :method "DOM.querySelectorAll", :params {"nodeId" 16, "selector" ".com-rigsomelight-devcards-list-group"}}, :error {:code -32000, :message "Could not find node with given id"}}
 at clj_chrome_devtools.impl.command$command.invokeStatic (command.clj:25)
    clj_chrome_devtools.impl.command$command.invoke (command.clj:17)
    clj_chrome_devtools.commands.dom$query_selector_all.invokeStatic (dom.clj:1282)
    clj_chrome_devtools.commands.dom$query_selector_all.invoke (dom.clj:1270)
    clj_chrome_devtools.automation$sel$evaluate__18012__auto____18296.invoke (automation.clj:186)
    clj_chrome_devtools.automation$sel.invokeStatic (automation.clj:183)
    clj_chrome_devtools.automation$sel.invoke (automation.clj:179)
    kamera.core$element_exists_QMARK_$fn__20092.invoke (core.clj:203)
    kamera.core$wait_for$evaluate__18012__auto____20095.invoke (core.clj:206)
    kamera.core$wait_for.invokeStatic (core.clj:206)
    kamera.core$wait_for.invoke (core.clj:205)
    kamera.devcards$test_devcards.invokeStatic (devcards.clj:96)
    kamera.devcards$test_devcards.invoke (devcards.clj:78)
    kamera.devcards$test_devcards.invokeStatic (devcards.clj:88)
    kamera.devcards$test_devcards.invoke (devcards.clj:78)
    kamera.devcards$test_devcards$fn__29243.invoke (devcards.clj:83)
    kamera.core$with_chrome_session$fn__20134$fn__20135.invoke (core.clj:304)
    clj_chrome_devtools.automation.fixture$create_chrome_fixture$fn__18702.invoke (fixture.clj:29)
    kamera.core$with_chrome_session$fn__20134.invoke (core.clj:301)
    clojure.core$with_redefs_fn.invokeStatic (core.clj:7514)
    clojure.core$with_redefs_fn.invoke (core.clj:7498)
    kamera.core$with_chrome_session.invokeStatic (core.clj:299)
    kamera.core$with_chrome_session.invoke (core.clj:297)
    kamera.devcards$test_devcards.invokeStatic (devcards.clj:81)
    kamera.devcards$test_devcards.invoke (devcards.clj:78)

It's an intermittent failure that happens ~75% of the time.

@oliyh oliyh closed this as completed in 434bbc9 Nov 9, 2020
@jleonard-r7
Copy link
Contributor Author

This commit actually didn't fix the issue:

ERROR in (devcards-test) (command.clj:25)
Uncaught exception, not in assertion.
expected: nil
  actual: clojure.lang.ExceptionInfo: Error in command DOM.querySelector: Could not find node with given id
{:request {:id 19, :method "DOM.querySelector", :params {"nodeId" 39, "selector" ".com-rigsomelight-devcards-list-group"}}, :error {:code -32000, :message "Could not find node with given id"}}
 at clj_chrome_devtools.impl.command$command.invokeStatic (command.clj:25)
    clj_chrome_devtools.impl.command$command.invoke (command.clj:17)
    clj_chrome_devtools.commands.dom$query_selector.invokeStatic (dom.clj:1235)
    clj_chrome_devtools.commands.dom$query_selector.invoke (dom.clj:1223)
    clj_chrome_devtools.automation$sel1$evaluate__18012__auto____18308.invoke (automation.clj:194)
    clj_chrome_devtools.automation$sel1.invokeStatic (automation.clj:193)
    clj_chrome_devtools.automation$sel1.invoke (automation.clj:189)
    clj_chrome_devtools.automation$to_node_ref.invokeStatic (automation.clj:51)
    clj_chrome_devtools.automation$to_node_ref.invoke (automation.clj:44)
    clj_chrome_devtools.automation$visible.invokeStatic (automation.clj:264)
    clj_chrome_devtools.automation$visible.invoke (automation.clj:260)
    kamera.core$element_exists_QMARK_$fn__20092.invoke (core.clj:203)
    kamera.core$wait_for$evaluate__18012__auto____20095.invoke (core.clj:206)
    kamera.core$wait_for.invokeStatic (core.clj:206)
    kamera.core$wait_for.invoke (core.clj:205)
    kamera.devcards$test_devcards.invokeStatic (devcards.clj:96)
    kamera.devcards$test_devcards.invoke (devcards.clj:78)
    kamera.devcards$test_devcards.invokeStatic (devcards.clj:88)
    kamera.devcards$test_devcards.invoke (devcards.clj:78)
    kamera.devcards$test_devcards$fn__29247.invoke (devcards.clj:83)
    kamera.core$with_chrome_session$fn__20134$fn__20135.invoke (core.clj:304)
    clj_chrome_devtools.automation.fixture$create_chrome_fixture$fn__18702.invoke (fixture.clj:29)
    kamera.core$with_chrome_session$fn__20134.invoke (core.clj:301)
    clojure.core$with_redefs_fn.invokeStatic (core.clj:7514)
    clojure.core$with_redefs_fn.invoke (core.clj:7498)
    kamera.core$with_chrome_session.invokeStatic (core.clj:299)
    kamera.core$with_chrome_session.invoke (core.clj:297)
    kamera.devcards$test_devcards.invokeStatic (devcards.clj:81)
    kamera.devcards$test_devcards.invoke (devcards.clj:78)

Perhaps there's a non-throwing equivalent in clj_chrome_devtools? Or if not, wrap in try/catch and retry ?

@jleonard-r7
Copy link
Contributor Author

FYI: this latest commit seems to have fixed it. 10 runs so far and 100% success rate. Thanks!

@oliyh
Copy link
Owner

oliyh commented Nov 10, 2020

Hi,

That's good to hear, thanks for the feedback. I haven't had this on any of my own projects. Do you have a particularly large amount of devcards, or large JavaScript files?

Cheers

@jleonard-r7
Copy link
Contributor Author

Maybe 25 or so devcards but yea large files for sure.

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