How to get native Range from ProseMirror selection without setting the window selection?

I’m writing end-to-end tests and would like to be able to measure a ProseMirror selection on the screen so I can do some mouse interactions. The thing is, I don’t want to just change the selection and measure the current selection.

It seems like it should be possible to reuse some logic from this function:

Any thoughts on how best to do this?

Thanks,

Chet

Would domAtPos or even coordsAtPos help here? Just get the selection end points, either directly as coordinates, or as DOM position you can put into a range.

Oh perfect. That totally works :grinning_face_with_smiling_eyes: