-
-
Notifications
You must be signed in to change notification settings - Fork 760
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
iOS/Android driver compatibility issue on a cross-platform testing #405
Comments
@sbjymc I see above link is broken. I recommend to go through our Release log (both client and server) and sync up with the releases every time we update.Since you are using old version of java-client doesn't mean java-client is not user friendly for cross platform compatibility.There are lot more wonderful features/fixes we released there after. Try to go through our wiki and the change logs.Incase of any questions please raise in discuss.appium.io. Please do raise issues incase if any along with server logs inform of gist to look further.Happy to help if the issue template is followed properly. |
There a lot of changes have been added since 2.1.0. It is possible that new releases are not compatible with code that uses very old versions. Please follow the @SrinivasanTarget's advice. |
But we can solve each one separated problem. You can open an issue for each one problem that you face and a bug is suspected. |
@SrinivasanTarget @TikhomirovSergey However, We could not share test code(librarys) between iOS and Android using one driver and this seems to make our framework more complex. we have to setup 2 projects for ios and android since we need to initialize 2 different driver for them. PS: the link I paste could be opened by copy/paste directly in browser. Thanks for your kindly help. |
I use something like:
where isTargetAndroid() is a private method in my code which returns whether the script was started with android or ios as target.
I then use the driver in all of my tests. |
I also think that the find by name locator strategy has been removed lately. |
@rompic thanks for you kindly help. I have a question in your code:
The object 'driver' is created by 'AppiumDriver' or 'IOSDriver' or 'AndroidDriver' ? |
driver is a static class variable of the AppiumDriver type |
And the instance is created by the relevant method |
thanks @rompic, I will try it on my codes. |
hi @rompic |
Update my last comments since some code could not be recognized by web scripts |
What do you mean exactly? |
@sbjymc i guess I see your point now concerning the features of iOS and Android drivers I have a generic AppiumDriver and create an instance of Android or IOSDriver depending on a system property. Now I cannot access driver.toggleLocationServices() which is only available for android. @TikhomirovSergey what is the best way to handle this? |
seems to do the trick |
@rompic : We follow the same approach as you suggested. At run time we get an instance of driver and check whether it belongs to AndroidDriver or iOSDriver. If user access any methods specific to iOS while automating on android, we throw an UnsupportedOperationException. |
Got it, thanks @rompic |
Description
I'm using java-client 2.10 in my appium test framework, it's working good on my environment both for ios and android native application testing, I can reuse almost all the basic method like below:
public static AppiumDriver driver;
public static void setUp() {
if (PLATFORM_NAME.equals("ios")){
driver = new IOSDriver(new URL(DRIVER_AGENT),capabilities);
}
if (PLATFORM_NAME.equals("android")){
driver = new AndroidDriver(new URL(DRIVER_AGENT),capabilities);
}
}
Then I can create some common method likes 'click a object name' for both ios and android
public static void clickObjectByName(final String ObjectName) {
driver.findElementByName(ObjectName).click();
}
However, the driver is not working when I upgraded Java-client to 3.4.0
it request to create separately 'AndDriver' and 'iOSDRIVER' instance, it means that the common methods which I setup in above example could not be reuse again, and I need to setup 2 different test framework for ios and android.
So I think current Java-Client is not friendly for the cross-platform compatibility. can we make some updates?
And I found several people have the same query, here is the link:
https://discuss.appium.io/t/ios-android-driver-casting-on-a-shared-test-code-base/1095
The text was updated successfully, but these errors were encountered: