The API appiumDriver.getCapabilities().getPlatform().is(Platform.ANDROID)) is returning false even if the Phone is Android. I had raised an issue, but I think a member closed it off without giving due diligence. Please refer the issue #919
I have set the following capabilities.
DEVICE_NAME, UDID, ACCEPT_SSL_CERTS, AUTO_WEBVIEW, NEW_COMMAND_TIMEOUT, APPIUM_VERSION, FULL_RESET, NO_RESET, PLATFORM_NAME, AUTO_GRANT_PERMISSIONS, APP_PACKAGE and APP_ACTIVITY.
Calling the API appiumDriver.getCapabilities().getPlatform().is(Platform.ANDROID)) is returning false even if the Phone is Android. The Enum Platform (org.openqa.selenium) has Windows, Android, iOS, Linux and other options as well. So I think it is not returning based on System OS as well.
Ok i will revisit this. Meanwhile you can use sessionDetails until this is resolved.
@SrinivasanTarget Thanks.
@VinnieM platform capabilitytype is officially deprecated at selenium end already so i don't see a point in fixing this at appium end.
Also platformName still holds and provides MAC as platform name. May be that needs to be fixed. May be.
I guess it鈥檚 better to mark the API (getPlatform)deprecated as well... and refer in the doc to use sessionDetails... what do you think?
getPlatform won't get deprecated since it gets the platform from platformName capability incase platform capability type is not set.
Do you want me to raise a new bug on platformName as Mac thingy? I didn鈥檛 notice it since I was only looking at Android.
No need. There is already a workaround for setting platformName capability at Appium Java client side properly during driver creation. It's that getPlatform or getPlatformName needs to be fixed.
I鈥檓 sorry I was referring to the Enum Platform. Can鈥檛 we depreciate that? Or is it used for anything else?
Ok to make it more clear. CapabilityType called platform is officially deprecated but platformName capability and Platform enum still holds. yes, it was confusing to keep both platform and platformName and soplatform capabilityType is deprecated. May be better solution is to use driver.getSessionDetails. Also driver.getCapabilities().getCapability('platformName'); should also return the platform info but it isn't (returns MAC instead). i will fix that soon.
Thanks for clearing up the confusion.
@VinnieM I have fixed this. driver.getCapabilities().getCapability('platformName'); will return the platform going forward. Feel free to use this after the new release instead of getting it from session details.
Thanks for putting in the effort.
Most helpful comment
@VinnieM I have fixed this.
driver.getCapabilities().getCapability('platformName');will return the platform going forward. Feel free to use this after the new release instead of getting it from session details.