stevepryde/thirtyfour

Does `query` work on child elements?

AshleySchaeffer opened this issue · 3 comments

Apologies, but I'm not sure if I've found a bug or I don't understand the query capabilities. I'll happily change the title of this issue if it's turns out to be a bug.

After querying for elements matching a tag is it possible to then use query to find child elements?

I'm seeing odd results where parent_element.find_all(By::Tag("h1")) returns child elements but parent_element.query(By::Tag("h1")).all() does not.

OK after some experimentation, it appears that the query variant requires nowait to be used, like this parent_element.query(By::Tag("h1")).nowait().all().

With it I'm getting the expected results (the same for both approaches).

Does this sound like a bug or something that just needs documenting?

If you need more info or would like me to change anything about this issue, just let me know.

It should find the same elements if they are indeed there on the page. The nowait() just means it will not poll. With that option the behaviour should be identical between them. Without that option it should wait until at least one element is found and then return.

I will have a look into this when I get time.

I've done some tests and it seems to be working as intended for me.

Without nowait() it should poll according to the poller configuration (by default it polls every 0.5 seconds up to 20 seconds after which it will timeout). It will return as soon as it finds at least one element.

With nowait() it will not poll at all, and returns immediately. If you're checking for the non-existence of an element, you should use not_exists() instead.

What version of thirtyfour are you using?