dotnet-client icon indicating copy to clipboard operation
dotnet-client copied to clipboard

[Feat]: RelativeBy functionality from Selenium 4

Open aaronportier opened this issue 1 year ago • 5 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. I have radio buttons and check boxes next to text that contains automation IDs it would be nice to tell my app left of instead of creating automation IDs for checkboxes.

Describe the solution you'd like Selenium 4 brought RelativeBy functionality. I would love to use that in appium.

Describe alternatives you've considered Automation IDs everywhere on everything.

Additional context I see lots of deprecation for newer Selenium functionality but not a whole lot of new and added functionality that Selenium should bring.

aaronportier avatar Mar 23 '24 13:03 aaronportier

Related article: https://saucelabs.com/resources/blog/selenium-4-relative-locators

Dor-bl avatar Mar 25 '24 20:03 Dor-bl

These locators rely on the native implementation. In case of selenium/browser automation it is easy to do something like that since under the hood they have css location. As a result, relative locators could easily be transformed into native ones. There is completely different story on mobile platforms though. Neither XCTest nor UIAutomator frameworks implement the concept of relative locators. For us, as backend developers, this means we'd need to map such locators into xpath ones, as it is the only locator type, which supports the idea of search axes. It's not only failry complicated task, but also a slow one, since xpath is the slowest location strategy (it's completely "artificial" and is not supported natively, especially in case of XCTest, where various XPath locators may take 10x to 100x more time in comparison to native ones)

mykola-mokhnach avatar Mar 25 '24 21:03 mykola-mokhnach

Let alone we can't easily inherit from this class (RelativeBy) since it's not abstract. @titusfortner @nvborisenko is there a plan for making RelativeBy abstract? Or is there a good reason behind it

Dor-bl avatar Mar 25 '24 21:03 Dor-bl

static members, what are not considered as inheritable? In any case we are open for any non-breaking changes (as quick win). Please propose your ideas, I don't see barriers for changes (breaking changes?..).

nvborisenko avatar Mar 25 '24 21:03 nvborisenko

Ah, forgot to answer on your question. RelativeBy will not be abstract in discoverable future, it is concrete type. I don't see problems to make some parts as virtual.

nvborisenko avatar Mar 25 '24 21:03 nvborisenko

Closing this issue for now since, as things currently stand, it requires too much effort, and the implementation won't be so effective.

Dor-bl avatar Feb 13 '25 08:02 Dor-bl