This is my first go at it but I think it works pretty well.
I made a couple of adjustments.
the private findElementsBy now takes a By and a String selector, and does the toBy inside of it, so that we can preserve the original selector.
On timeout, it will take the selector or By and find all the elements, and given the text, tag name, and resourceId build up a bunch of possible selectors (including the pseudo selectors we made up) and then run the distance algo on them.
This is my first go at it but I think it works pretty well.
I made a couple of adjustments.
the private findElementsBy now takes a By and a String selector, and does the toBy inside of it, so that we can preserve the original selector.
On timeout, it will take the selector or By and find all the elements, and given the text, tag name, and resourceId build up a bunch of possible selectors (including the pseudo selectors we made up) and then run the distance algo on them.
t:Animation
->tv:Animation
tv:Animatio
->tv:Animation
etc
Please review and test it locally and tell me what you think!