-
Notifications
You must be signed in to change notification settings - Fork 96
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
query
doesn't correctly handle vectors inside of vectors
#672
Comments
Choice 3. Garbage in means undefined behaviour. This would require no change. Thoughts? |
Yes, GIGO (garbage in, garbage out) is also an option. I like it less than the other two because I think it puts the user in the bad position of having to debug a not-very-well-specified system. One of the consistently listed issues for the Clojure language is that error messages are cryptic. This occurs because typing is dynamic and unconstrained inputs are passed to functions deep in a call stack where they blow up. It would be better to either say "this is supported," or "this is not supported" and get an accurate error message. BTW, I see either option 1 or 2 as being non-breaking. Today, it doesn't work, so making it work (option 2) wouldn't break anything. Today, in some cases, it will throw an exception, so with option 1, it will still throw an exception, but a better one and one thrown for the right reasons. |
Option 4. Introduce spec or malli and let folks turn on instrumentation if they want it. If you feel strongly about doing something here, and don't like option 4, option 1 seems ok to me. Option 2 is too much magic for me. |
Option 4 is a much heavier lift. IMO, more libraries should start using Malli/spec to constrain things, but it's harder for an existing library like Etaoin to retrofit everything. In this case, I'm suggesting tightening things up because |
Option 5: document that it's not supported and that GIGO may result if attempted. That's a quick, 1-line or thereabouts, doc change with no affect on code at all. But I think that's weak sauce because it's relatively easy to do either Option 1 or Option 2. |
Yep option 4 is big (and perhaps a maintenance burden), but it is an option. I personally would not bother, but if you feel strongly about it go for option 1 (or 5). |
OK, I hear you on option 1 or 5. But just FYI, option 2, flattening, is actually easier than option 1, in terms of code. You just need to call |
Yeah but option 2 is automatically "helping" the user recover from a mistake they made. |
I don't necessarily agree that it's a user mistake. Again, it might be the easiest way to generate the DOM path. Think about how Hiccup works. Ultimately, it's serialized and flattened, but you manipulate it as vectors of vectors, which allows for generator functions to create sub-paths and then those just get wrapped in a collection. But it's also easy for the user to call So, I'll submit a PR for option 1. |
Version
1.1.42
Platform
All
Symptom
The
query
function accepts a number of query types (e.g., keyword, string, map) that indirectly specify a WebDriver query.query
also allows for a vector argument which can contain multiple of these other query types, allowing the programmer to specify a rough path through the DOM to the desired element.Etaoin's documentation (both doc strings and User Guide) does not speak to whether a vector can contain other vectors and if allowed what that behavior should be.
Actual behavior
Today, the behavior is a bit random. Here is some data from the REPL:
Expected behavior
The behavior should be consistent. I believe there are two possible choices:
flatten
-ed. That is, the sub-vectors just specify sub-paths through the DOM.Diagnosis
The code in
query
just needs to be updated.Action
I can supply a PR for either choice.
The text was updated successfully, but these errors were encountered: