-
-
Notifications
You must be signed in to change notification settings - Fork 759
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
Generic AppiumDriver #178 #162 fix #182
Generic AppiumDriver #178 #162 fix #182
Conversation
It would be cool to resolve the issue 147 before the new release... |
I'll rely on @Jonahss for a detailed review. I'm not sure that the test code is any cleaner as a result of this. I see |
Ok @bootstraponline WebElement e = driver.findElement(By.id("id"));
List<WebElement> e2 = e.findElements(By.id("id2")); I can improve test code if it is really needed. I think it is better to replace ? by WebElement. |
I'm still concerned with the need to do casting on the "chains" of finding. It's unpredictable to have to cast in that case, whereas always casting is annoying but predictable. |
Ok. then I will think about the way to improve this... List<MobileElement> l = e.findElements(By.id("id2")); ? As you can see it is possible. :) It is the worst case scenario. Actually I am going to look for the solution that is compatible with current user projects. |
It seems that I have found the acceptable solution:
So by default users will work as usual: AppiumDriver<?> driver;
//some actions
WebElement e = driver.findElement(By.id("id"));
List<WebElement> l = driver.findElements(By.id("id")); or AppiumDriver<WebElement> driver;
//some actions
WebElement e = driver.findElement(By.id("id"));
List<WebElement> l = driver.findElements(By.id("id")); But user can choose the desired type. WebElement, TouchableElement, RemoteWebElement, MobileElement or subclasses are allowed. So when they will choose something that differs from WebElement then: AppiumDriver<MobileElement> driver;
//some actions
MobileElement e = driver.findElement(By.id("id"));
List<MobileElement> l = driver.findElements(By.id("id"));
MobileElement e1. = e.findElement(By.id("id2"));
List<MobileElement> l = e.findElements(By.id("id2")); Everything is ready for commit. @Jonahss What do think about this? Is it ok? |
Ooh yeah I like that ^.^ |
I like the changes 👍 |
@Jonahss When you will check this please change Java compiler to "Eclipse" if you use IDEA or download Eclipse Luna if you are Eclipse user. I advice you to perform these (for the checking) following:
Actually I did the same and everything were cool. But you can do it to be sure that all is fine. Please let me know if something is wrong. This is one of the most uncommon tasks I've ever tried to resolve :) The similar thing is going to be proposed to С#. |
Haha yeah it's definitely a doozy of a Java task ;) Someday I still think it could be nice to start fresh. On Tue, Apr 7, 2015 at 2:46 PM, Sergey Tikhomirov [email protected]
|
Soon I will provide one more commit... It is about pom.xml settings |
I've improved pom.xml. So let's have fun :)) |
in order to avoid the conflict with another PR
Yeah! Required changes are on Selenium side now. (on behalf of Sergey Tikhomirov) Refactored PageFactory implementation, including a number of changes to make it more extensible and more robust.... I am going to propose a PR on this week or the beginning of the next! |
Oh super awesome. On Tue, Jun 9, 2015 at 2:52 PM, Sergey Tikhomirov [email protected]
|
Sorry. I have made a mistake. Another ticked has to be commented with my previous reply :)))) |
Oops, yeah I see it. On Tue, Jun 9, 2015 at 3:25 PM, Sergey Tikhomirov [email protected]
|
Hi All, Can you guys help me with dot net code samples after this change with generics for AppiumDriver. I Stuck and don't know how to proceed further. Or suggest changes for below piece of code using System; namespace ConsoleApplication1
} Thanks |
Could you post your issue to the dot net client repository then? this is On Tue, Jun 23, 2015 at 11:09 AM, RohitBandi [email protected]
|
is it possible to create driver object with WebDriver, |
The major change:
AppiumDriver is generic now and by default its finders return WebElement (it is for backward compatibility)
Possible drawbacks and backward compatibility issues:
"Rawtype" warnings. This issue is resolved by the infering of a type that implements/extends WebElement or via the suppressing of warnings like that
This solution requires IDEA (Community Edition is enough) that supports Eclipse compiler. It is compatible with Eclipse Luna or higher. It is better to use Maven v3.2.5 (I'm not sure. It is possible that minimal required version is lower. Actually I just use this version.) or higher when there is necessity to perform the local building.
The built *.jar is copmatible wits both IDEs (Eclipse can be older than Luna) without special settings:
IDEA
Eclipse
Additional changes
@Jonahss @bootstraponline
Please review this carefully. There is no need to hurry :) If these changes will be accepted I think that next version number should be 3.0