ulixee/secret-agent

feature request: support css string query in waitForElement

GlenDC opened this issue · 4 comments

Currently one has to first get the element using agent.document.querySelector prior to being able to use agent.waitForElement. It seems like a common enough pattern that we might as well support the string that you would pass to querySelector directly to a override version of waitForElement?

Might also entail that we need to in that case accept optional args on top of it.

See some comments on a similar idea at #290

For what it's worth, this idea has gained steam in Hero, but in a slightly different form. We've added extensions (in Hero) onto dom Elements querySelector('.big').$waitForVisible().

Nice. Feel free to close-as is in that case, I'm happy with that answer.
Will it also be possible for hero-users (so without having to fork it) to inject such extensions?

Cool! I'd very much like to figure out how to do that in the plugin structure. Databox (in ulixee project) has its own extenders. You can see that the structure is a bit complex to get typescript to recognize them.

https://github.com/ulixee/ulixee/blob/main/databox/client/lib/DomExtender.ts

Wouldn't be able to tell. But if you wish help with it in near future I do not mind helping to come with something, theoretical and/or as an implementation. For now it's like a sweet dream for me.