Closed Bug 944322 Opened 8 years ago Closed 4 years ago

[marionette-helper] waitForElement cannot wait for a element not in the DOM yet.


(Testing Graveyard :: JSMarionette, defect)

Not set


(Not tracked)



(Reporter: evanxd, Unassigned)


Hi all,

The waitForElement function cannot wait for a element not in the DOM yet.
Currently, if we wait for a element not in the DOM, we will get the error message "NoSuchElement: (7) Unable to locate element: ".

It is useful to wait for a element from it is not in the DOM yet until it is displayed.
How do you guys think?
Summary: [marionette-helper] waitForElement cannot wait for a element doesn't exist yet. → [marionette-helper] waitForElement cannot wait for a element not in the DOM yet.
If you guys think it is useful, we could let the waitForElement function do this thing.
Flags: needinfo?(gaye)
Flags: needinfo?(jlal)
Flags: needinfo?(mike)
So mhenretty ran into similar things but I think this is either a logic bug somewhere in our tests/client/marionette server... In theory marionette _should_ wait until the element is found in the DOM.


Lets fix the problem at the server level if there is an issue.
Flags: needinfo?(jlal) → needinfo?(mhenretty)
Evan: the source file James shared confused me a bit, so I want to share what I've learned in case it helps.

That file is a bit confusing because it defines `findElement`, and `findElements` methods, but only the `find` method implements the retry/timeout logic [1] documented by the Python client [2]. Those methods are all private; the public `findElement` and `findElements` are defined in `marionette-server.js` [3], and *those* implementations use the private `find` method that James originally linked to.

Given that, one would expect the `marionette-helper` plugin's `waitForElement` method to exhibit similar retry/timeout behavior since it uses `findElement` [4]. I tend to agree with James about there being a bug in the server itself, and I also think it makes the most sense to fix the root cause.

Flags: needinfo?(mike)
The `waitForElement` marionette helper method will indeed wait for an element that is not yet in the DOM. At first, I thought `findElement` would immediately return a `NoSuchElement` error if the element was not in the DOM, but it turns out I just had my searchTimeout set too low. I wrote a test to verify this, so unless I am missing something I think this is working as intended:
Flags: needinfo?(mhenretty)
Flags: needinfo?(gaye)
Bulk closed as part of
Closed: 4 years ago
Resolution: --- → INCOMPLETE
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.