etaoin 2018-05-13

@dottedmag has joined the channel

How do I list frames in etaoin? I've got an ancient page with frameset and frames. The frame I need does not have an id, only name attribute, and I can't figure out how to select it.

Hmm, after some poking around I've got it working: (switch-frame driver {:tag "frame" :name "mainFrame"})

@dottedmag the switch-frame function takes any term that is used to query DOM. A keywords stands for an element’s ID, but you are also welcome to pass a map or a vector of maps.

@igrishaev Thanks, I've already got used to it 🙂

@igrishaev By any chance, do you know what's the best way to query elements in Shadow DOM? I'm using {:css "* /deep/ input"}, but /deep/ is deprecated.

@dottedmag well, I’m not too familiar with the shadow DOM. The last time, I remember, I had to run a js script to query them.

Another question: I use (query-all driver "//select[@name=\"...\"]/option") and (map #'e/get-element-value-el %) on the result in order to obtain a list of options for select element, is there a better way?

yes that works, although I consider this is being a bit long. I’ve beed thinking on some refactoring here but without any result.

I mean, query/query-all return a system id, but not an object as Selenium does.

get-element-value-el is not exported, so it looks a bit dirty.

Yes, it’s for internal use I remember. It would be great to return not a plain id but wrap it with a typed record maybe to let other functions be more flexible.

And will break for non-Chrome, as I see from the code.

Would that also remove the -el/non-`-el` distinction from API?

Hm, it should work for non-Chrome, why not?

I see that get-element-value delegates to get-element-attr and get-element-property for Safari, Phantom and FF.

-el functions take not a query term but a naked ID produced by query/query-all

ah, I see now. Yes, get-element-value-el works in Chrome only, that’s why it’s low-level and isn’t exported.

So yes, the API aren’t flexible enough, some refactoring is required.

OK, so I won't be looking for a better way for now 🙂