Uh oh!
There was an error while loading. Please reload this page.
Conversation
TikhomirovSergey
commented
Mar 15, 2015
Jonahss
commented
Mar 20, 2015
TikhomirovSergey
commented
Mar 20, 2015
Ok. I've just proposed it. If you consider that this PR is not consistent please close it without merging. Actually I think it is not crucial that users can't get MobileElement without casting.
I am sorry if I made you think so. I was too optimistic. :) |
Jonahss
commented
Mar 20, 2015
Hm. The convenience of not having to cast to MobileElement vs the confusion of having to cast when using plural finders. What does @bootstraponline think? |
bootstraponline
commented
Mar 21, 2015
I like it. I think the code is cleaner without having to cast all the time. |
TikhomirovSergey
commented
Mar 21, 2015
@bootstraponline List<WebElement> I = driver.findElements(by);
MobileElementm = (MobileElement ) l.get(0); The architecture of RemoteWebDriver API and Java by itself are both prevent the following use case List<MobileElement> I = driver.findElements(by);and |
bootstraponline
commented
Mar 21, 2015
I think overall, it'll be less casting for the common use case of finding and acting upon an element. - MobileElement e = (MobileElement) driver.findElement(MobileBy.AccessibilityId("App"));+ MobileElement e = driver.findElement(MobileBy.AccessibilityId("App"));Casting in the list.get(0) case is pretty common in Java. |
bootstraponline
commented
Mar 21, 2015
It's your PR so if you think it's better not to merge, that's fine. I don't feel strongly either way. |
TikhomirovSergey
commented
Mar 23, 2015
Ok @bootstraponline So, let @Jonahss make a desicion. Actually, today or tomorrow I am going to propose the similar changes to C#. And it is possible to provide both usecases: MobileElemente = driver.findElement(by);List<MobileElement> l = driver.findElements(by); |
Jonahss
commented
Mar 23, 2015
This is exactly the sort of thing I don't like about Java, but I'm ok with merging this ^.^ |
TikhomirovSergey
commented
Mar 24, 2015
Thank you @Jonahss |

I have tried to override findElements(By) and findElementsBy*. But there are casting problems of java-collections. Also there is a problem of backward compatibility. Sometimes I hate Java :)