-
-
Notifications
You must be signed in to change notification settings - Fork 765
#162 fix #167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#162 fix #167
Conversation
|
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. :) |
|
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? |
|
I like it. I think the code is cleaner without having to cast all the time. |
|
@bootstraponline List<WebElement> I = driver.findElements(by);
MobileElement m = (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 |
|
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. |
|
It's your PR so if you think it's better not to merge, that's fine. I don't feel strongly either way. |
|
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: MobileElement e = driver.findElement(by);List<MobileElement> l = driver.findElements(by); |
|
This is exactly the sort of thing I don't like about Java, but I'm ok with merging this ^.^ |
|
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 :)